dijkstra-backend-cloudron/api/routes/countriesRouter.js

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;