geographic.js 349 Bytes
Newer Older
1
function getJson(infoType) {
2 3
  const json = require(`${__dirname}/geographic/${infoType}.json`); // eslint-disable-line
  return json;
4 5 6 7 8 9 10 11 12 13 14 15 16 17
}

export function getProvince(req, res) {
  res.json(getJson('province'));
}

export function getCity(req, res) {
  res.json(getJson('city')[req.params.province]);
}

export default {
  getProvince,
  getCity,
};