This is the code for the Timestamp Microservice project. Instructions for building your project can be found at https://www.freecodecamp.org/learn/apis-and-microservices/apis-and-microservices-projects/exercise-tracker
Set up four endpoints (two POSTs, two GETs)
- POST to
/api/users- @param: { username: string }
- @return: { username: string, _id: string }
- GET to
/api/users- @return: { username: string, _id: string }[]
- POST to
/api/users/:_id/exercises- @param: { description: string, duration: number, date?: Date }
- @return: { _id: string, username: string, date: string, duration: number, description: string }
- GET to
/api/users/:_id/logs- @query: ?from {string} in format YYYY-MM-DD
- &to {string} in format YYYY-MM-DD
- &limit {string} in format YYYY-MM-DD
- @return: { _id: string, username: string, count: number, logs: { description: string, duration: string, date: Date(from dateString) }[] }
- @query: ?from {string} in format YYYY-MM-DD
Typescript will be a big aid to creating this API.
The file structure has been divided to represent an MVC approach.