const router = require("express").Router(); const getCountries = require("../models/getCountries.js"); const getCountryById = require("../models/getCountryById.js"); module.exports = dbConn => { router.get("/api/v1/countries", async (req, res) => { res.json(await getCountries(dbConn)); }); router.get("/api/v1/countries/:id", async (req, res) => { const id = req.params.id; res.json(await getCountryById(dbConn, id)) }); return router; };