dijkstra-backend/api/routes/countriesRouter.js

15 lines
384 B
JavaScript
Raw Normal View History

2020-02-08 18:59:51 +00:00
const router = require('express').Router();
const Cities = require('../models/citiesModel');
router.get('/:country_id', async (req, res) => {
const { country_id } = req.params;
try {
const cities = await Cities.getCitiesByCountry(country_id);
res.status(200).json(cities);
} catch (e) {
res.status(500).json(e);
}
})
module.exports = router;