HEALTY WAY APP backend
Welcome to the Healthy Way App DARK SIDE!
To get started with the project, follow these steps:
Clone this repository to your local machine:
git clone
tap!
Change directory to the project folder:
cd healthy-way-backend
Install the project dependencies:
npm install
Start the development server:
npm run start:dev
Server will start on the http://localhost:3000
or BASE Render URL
to access the application.
POST ####/api/auth/registration - new user's registration
{
"name": "Ljuzifer",
"email": "Ljuzifer@gmail.com",
"password": "123456",
"goal": "Gain muscle",
"gender": "Male",
"age": 37,
"height": 188,
"weight": 100,
"activityRatio": 1.55
}
POST ####/api/auth/verify - verify new user's email if verification letter doesn't came
{
"email": "email@email.com" - `real email that was registrated`
}
POST ####/api/auth/login - user's login
{
"email": "Ljuzifer@gmail.com",
"password": "123456"
}
POST ####/api/auth/logout - user's logout
headers.authorization: Bearer accessToken
POST ####/api/auth/refresh - update access & refresh tokens
{
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY1ODIzY2NhYWUwNjhiMTQwMTZkNTI2MyIsIm5hbWUiOiJManV6aWZlciIsImlhdCI6MTcwMzAzNDE0MywiZXhwIjoxNzA0MTU3MzQzfQ.One4kXthbjqcQpOC5VlZuYxXU9tU7_-WFEqSwCTwd8o"
}
POST ####/api/auth/forgot-password - regenerate user's new password
{
"email": "Ljuzifer@gmail.com"
}
PUT ####/api/auth/change-password - change user's password
headers.authorization: Bearer accessToken
{
"email": "Ljuzifer@gmail.com",
"password": "123456",
"newPassword": "654321"
}
DELETE ####/api/auth/delete/:password - deleting user's account
headers.authorization: Bearer accessToken
GET ####/api/user/current - get user's current information
headers.authorization: Bearer accessToken
PUT ####/api/user/update - update user's information
headers.authorization: Bearer accessToken
{
"name": "Dimon",
"gender": "Male",
"age": 37,
"weight": 108,
"height": 188,
"activityRatio": 1.9
} - all not required
POST ####/api/user/load-avatar - upload user's avatar
headers.authorization: Bearer accessToken
(At cloudinary, the photo is currently being processed and converted to .png)
GET ####/api/user/recommended-food - get the recommended food
headers.authorization: Bearer accessToken
GET ####/api/user/food - get user's diary food
headers.authorization: Bearer accessToken
POST ####/api/user/food - add user's diary food
headers.authorization: Bearer accessToken
{
"diary": "Breakfast",
"name": "ukrainian borshch",
"carbohydrate": 50,
"protein": 40,
"fat": 20,
"calories": 666
}
PUT ####/api/user/food/:foodId example 657f725654a5a8a137879071 - update diary's food
headers.authorization: Bearer accessToken
req.body: all not required
{
"diary": "Breakfast",
"name": "ukrainian borshch",
"carbohydrate": 50,
"protein": 40,
"fat": 20,
"calories": 666
}
DELETE ####/api/user/food/:foodId example 657f725654a5a8a137879071 - delete diary's food
headers.authorization: Bearer accessToken
PUT ####/api/user/goal - change user's goal
headers.authorization: Bearer accessToken
{
"goal": "Gain muscle"
}
PUT ####/api/user/weight - change user's weight
headers.authorization: Bearer accessToken
GET ####/api/user/water - get user's water level
headers.authorization: Bearer accessToken
PUT ####/api/user/water - update user's water level
headers.authorization: Bearer accessToken
DELETE ####/api/user/water - reset water level
headers.authorization: Bearer accessToken
GET ####/api/user/statistics... - statistics for specific periods
headers.authorization: Bearer accessToken
?period=today - for the current day
?period=year - for the current year
?period=month&month=05 - the number of a specific month in the format from 01 to 12 - for the specific month
?period=month&quantity=5 - quantity of months - for a specific number of recent months