https://exercise-tracker-three-peach.vercel.app/
The backend of the Exercise Tracker Microservice is a Node.js application using the Express framework, designed to provide exercise tracking functionalities. The application includes routes to handle HTTP requests, process data, and return responses formatted in JSON.
-
Create User:
- Allows the creation of a new user with a unique username.
- Endpoint:
POST /api/users - Response: Returns an object with
usernameand_idproperties.
- Endpoint:
- Allows the creation of a new user with a unique username.
-
Add Exercise:
- Allows users to add exercises with a description, duration, and date.
- Endpoint:
POST /api/users/:_id/exercises - Response: Returns the user object with the added exercise fields:
description,duration,date.
- Endpoint:
- Allows users to add exercises with a description, duration, and date.
-
Get Users:
- Retrieves a list of all users.
- Endpoint:
GET /api/users - Response: Returns an array of users with
_idandusernameproperties.
- Endpoint:
- Retrieves a list of all users.
-
Get Exercise Logs:
- Retrieves a user's exercise log with optional filters for date range and limit.
- Endpoint:
GET /api/users/:_id/logs?[from][&to][&limit] - Response: Returns a user object with a
logarray,countof exercises, and other user details.
- Endpoint:
- Retrieves a user's exercise log with optional filters for date range and limit.
The Exercise Tracker Microservice can be used to keep track of exercise routines, helping users maintain a record of their physical activities. This can be particularly useful for fitness enthusiasts, personal trainers, and health-conscious individuals who want to monitor their progress over time.
-
Create a New User:
- A user submits their username through the form, which sends a
POSTrequest to the backend. - The backend processes the request, creates the user, and returns the user details in JSON format.
- A user submits their username through the form, which sends a
-
Add an Exercise:
- The user adds an exercise by filling in the details (description, duration, date) and submits it via the form.
- The backend receives the data, associates the exercise with the user, and returns the updated user information with the exercise details.
-
Retrieve Exercise Logs:
- The user requests their exercise logs by providing their user ID and optional filters (e.g., date range, limit).
- The backend processes the request, filters the exercise records, and returns the log in JSON format, including a count of exercises.
-
Personal Fitness Management: Helps users track their exercise routines and maintain consistent records over time.
-
Progress Monitoring: Allows users to review their exercise history and assess their progress, enabling better workout planning.
-
Data Filtering: Users can filter their exercise logs by date and limit, making it easier to focus on specific periods or recent activities.
With this structure, the Exercise Tracker Microservice provides an efficient and organized solution for managing and reviewing exercise data in a personal or professional fitness context.