- A backend application that allows adding a user and tracks their exercise progress using NodeJS, ExpressJS, and MongoDB.
- This is my final solution of the FreeCodeCampe Exercise Tracker challenge.
- Reference: https://www.freecodecamp.org/learn/back-end-development-and-apis/back-end-development-and-apis-projects/exercise-tracker
- Create a new
.env
file and put the correspondingkey-value
pairs.
# * MongoDB
MONGODB_URI=
# * Local
PORT=
- Run the following commands.
npm run build
npm run dev
- REST API endpoints.
# Create a User
HTTP METHOD: POST
URL: http://localhost:14000/api/users
Body (JSON Raw):
{ "username": string }
# Get the Users
HTTP METHOD: POST
URL: http://localhost:14000/api/users
# Create an Exercise
HTTP METHOD: POST
URL: http://localhost:14000/api/users/:_id/exercises
Param: { _id: "user id" }
Body (Form Data):
{ "date": string (optional), "description": string, "duration": number }
# Get Logs
HTTP METHOD: GET
URL: http://localhost:14000/api/users/:_id/logs
Param: { _id: string }