Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions zip-api/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,22 @@ app.get('/', (req, res) => {


app.get('/zip/:zipcode', (req, res) => {
// fill in...
//extract route parameter | zipCode : string
const zipCode = req.params.zipcode;
//access value through byZip object through zipCode key
let result = zipdb.byZip[zipCode];
//return JSON data
res.json(result);
});


app.get('/city/:cityname', (req, res) => {
// fill in...
//extract route param.
const cityName = req.params.cityname;
//access data associated with key
let result = zipdb.byCity[cityName];
//return JSON data
res.json(result);
});


Expand Down
Loading