geographic.js 340 Bytes
Newer Older
陈帅's avatar
陈帅 committed
1 2
import city from './geographic/city.json';
import province from './geographic/province.json';
陈帅's avatar
陈帅 committed
3

愚道's avatar
愚道 committed
4
function getProvince(req, res) {
陈帅's avatar
陈帅 committed
5
  res.json(province);
陈帅's avatar
陈帅 committed
6 7
}

愚道's avatar
愚道 committed
8
function getCity(req, res) {
陈帅's avatar
陈帅 committed
9
  res.json(city[req.params.province]);
陈帅's avatar
陈帅 committed
10 11 12
}

export default {
愚道's avatar
愚道 committed
13 14
  'GET /api/geographic/province': getProvince,
  'GET /api/geographic/city/:province': getCity,
陈帅's avatar
陈帅 committed
15
};