geographic.js 354 Bytes
Newer Older
ι™ˆεΈ…'s avatar
ι™ˆεΈ… committed
1 2
import city from './geographic/city.json';
import province from './geographic/province.json';
3

ζ„šι“'s avatar
ζ„šι“ committed
4
function getProvince(req, res) {
ζ„šι“'s avatar
ζ„šι“ committed
5
  return res.json(province);
6 7
}

ζ„šι“'s avatar
ζ„šι“ committed
8
function getCity(req, res) {
ζ„šι“'s avatar
ζ„šι“ committed
9
  return res.json(city[req.params.province]);
10 11 12
}

export default {
ζ„šι“'s avatar
ζ„šι“ committed
13 14
  'GET /api/geographic/province': getProvince,
  'GET /api/geographic/city/:province': getCity,
15
};