diff --git a/zip-api/app.js b/zip-api/app.js index df1f97b..bde660c 100644 --- a/zip-api/app.js +++ b/zip-api/app.js @@ -15,12 +15,22 @@ app.get('/', (req, res) => { app.get('/zip/:zipcode', (req, res) => { - // fill in... + const records = zipdb.byZip[req.params.zipcode]; + if (records === undefined) { + res.sendStatus(404); + } else { + res.json(records); + } }); app.get('/city/:cityname', (req, res) => { - // fill in... + const records = zipdb.byCity[req.params.cityname]; + if (records === undefined) { + res.sendStatus(404); + } else { + res.json(records); + } });