geographic.js 327 Bytes
Newer Older
ι™ˆεΈ…'s avatar
ι™ˆεΈ… committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
function getJson(infoType) {
  const json = require(`${__dirname}/${infoType}.json`);
  return JSON.parse(json);
}

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,
};