npm installnpm start
Note: The server takes 30 seconds to initialize as it retrieves the trip data, parses it and fills the dictionary data structure we will access. Wait until you see Server listening on port 3000 in the console before sending requests.
npm test
You need to get your API token before accessing any endpoints.
-
Call
http://localhost:3000/auth/tokenin Postman and copy the value of the token field. -
Go to the Headers tab in Postman and add
Authorizationas a header key andBearer <your token here>as the value. -
Without your token, you will get a
403 Forbiddenresponse from the server.
- Each station has an ID from 2 - 673, though not all values are valid IDs.
- Send a
GETrequest tohttp://localhost:3000/station/:idwhere:idis a number within the stated range. For example:http://localhost:3000/station/2
2. Given one or more bike stations, return the number of riders in the age groups [0-20, 21-30, 31-40, 41-50, 51+, unknown] who ended their trip at that station for a given day
- In Postman, go to the Body tab and select
x-www-form-urlencodedand enter the following keys:- A key called
daywith a value in the formatYYYY-MM-DD. Dates are valid from2019-04-02to2019-06-30. - A key called
stationswith one or more station IDs separated by commas without spaces, for example113,264,81. IDs for particular stations can be found in the data file.
- A key called
- Send a
POSTrequest tohttp://localhost:3000/trip/ageGroups
- In Postman, go to the Body tab and select
x-www-form-urlencodedand enter the following keys:- A key called
daywith a value in the formatYYYY-MM-DD. Dates are valid from2019-04-02to2019-06-30. - A key called
stationswith one or more station IDs separated by commas without spaces, for example113,264,81. IDs for particular stations can be found in the data file.
- A key called
- Send a
POSTrequest tohttp://localhost:3000/trip/byStation