geographic.js 349 Bytes
Newer Older
陈帅's avatar
陈帅 committed
1
function getJson(infoType) {
2 3
  const json = require(`${__dirname}/geographic/${infoType}.json`); // eslint-disable-line
  return json;
陈帅's avatar
陈帅 committed
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,
};