dijkstra-backend/api/routes/countriesRouter.js
2020-02-08 19:59:51 +01:00

15 lines
384 B
JavaScript

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;