- Notifications
You must be signed in to change notification settings - Fork0
alvarezpj/zip-code-api
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This repository is the solution to theCUNY Tech Prep week 4 in-class project. The code contained here is meant to implement a zip code API usingExpress.js
. The API has two main endpoints:
- localhost:8000/zip/:zipcode
- localhost:8000/city/:cityname
The first endpoint is used to request information based on zip code number, and the second for retrieving all the zip codes associated with a given city name.
To start the API locally, change directories intozip-code-api
and runnode app.js
. Then, in a browser window, enter any of the two endpoints above. The API will respond appropriately if the zip code or city name is valid, otherwise a 404 code is returned in the response. For example:
- localhost:8000/zip/11377
- localhost:8000/city/WOODSIDE
note: for the city endpoint, the name of cities must be provided in all caps.