diff --git a/zip-api/app.js b/zip-api/app.js index df1f97b..bd146d6 100644 --- a/zip-api/app.js +++ b/zip-api/app.js @@ -14,16 +14,16 @@ app.get('/', (req, res) => { }); -app.get('/zip/:zipcode', (req, res) => { - // fill in... +app.get("/zip/:zipcode", (req, res) => { + const zipCode = req.params.zipcode; + res.json(zipdb.byZip[zipCode]); }); - -app.get('/city/:cityname', (req, res) => { - // fill in... +app.get("/city/:cityname", (req, res) => { + const cityName = req.params.cityname; + res.json(zipdb.byCity[cityName]); }); - app.listen(PORT, () => { console.log(`zip-api is up and running on ${PORT}`); });