Solution for the Workout Tracker challenge from roadmap.sh.
Workout Tracker built with Node.js, Express, and MySql. This project allows you to create account, add workouts with detels, add comments to your workouts, and delete workouts.
- Create account: Register new account with username and password.
- Login and Logout: With registration username and password.
- Add workout: Use login token to add new workout.
- Add comments to selected workout: You can add some comments to your workouts.
- List workouts: Show your workouts with comments you have added.
- Delete workout: Remove workout from your workouts list.
- Node.js
- npm
- MySql
-
Clone the repository to your local machine:
git clone https://github.com/Barkaaat/Workout-Tracker.git cd Workout-Tracker -
Install the required dependencies:
npm i
-
Ensure the
.envfile exists and contains your MySql connection data. -
Start the server:
npm start
- POST
/auth/register
- Request Body:
{ "username": "barakat", "password": "barakat123" }.
- POST
/auth/login
- Request Body:
{ "username": "barakat", "password": "barakat123" } - Get Response:
{ "message": "login successful", "token": token }.
- POST
/workout/add
- Headers authrization:
Bearer token - Request Body:
{ "name": workout name, "muscle": muscle, "sets": sets num, "reps": reps num, "scheduleDate": scheduled date }.
- POST
/workout/addComment
- Headers authrization:
Bearer token - Request Body:
{ "number": workout number, "comment": comment }
- DELETE
/workout/delete
- Headers authrization:
Bearer token - Request Body:
{ "number": workout number }
- POST
/auth/logout
- Headers authrization:
Bearer token