REST API built with NodeJS, Express and Knex to the app FitManager. This project is part of my portfolio, I'll accept suggestions and criticism. You can use this project as you wish!
This project was built with NodeJS 14.6, I recommend you use this version or similar.
Clone the repo
$ git clone https://github.com/nvrsantos/FitManager-server.git
$ cd fitManager-server
Installing dependencies
$ yarn
or
$ npm install
Set settings
- Change name of file
template_env
to.env
- Replace
<SECRET_KEY>
for your of key (anything), change<USER_DB>
and<PASSWORD_DB>
for credentials of connection of mongodb collection and end chance<EMAIL>
and<PASSWORD_EMAIL>
for credentials login of your service of email
In the environment of development execute
$ yarn dev
or
$ npm run dev
In the environment production execute
$ yarn start
or
$ npm run start
- This is the route that you can use to signin
ENDPOINT | Method | Body | URL Params | Success Response | Server Error Response |
---|---|---|---|---|---|
/ | POST |
{ <email>, <password> } |
- | Code: 200 - OK Content: { user: {<email>, <password>}, token: <Token JWT> } |
Code: 500 or 400 Content: { error: <A Message with a description of the Error> } |
- This is the route that you can use to create a new user
ENDPOINT | Method | Body | URL Params | Success Response | Server Error Response |
---|---|---|---|---|---|
/ | POST |
{ <name>, <email>, <password> } |
- | Code: 200 - OK Content: {message: <A Message Success>} |
Code: 500 or 400 Content: { error: <A Message with a description of the Error> } |
- This is the route that you can use to generate a new password and send to your email
ENDPOINT | Method | Body | URL Params | Success Response | Server Error Response |
---|---|---|---|---|---|
/ | POST |
{ <email> } |
- | Code: 200 - OK Content: {message: <A Message Success>} |
Code: 500 or 400 Content: { error: <A Message with a description of the Error> } |
ENDPOINT | Method | Body | URL Params | Success Response | Server Error Response |
---|---|---|---|---|---|
/ | GET |
- | - | Code: 200 - OK Content: { user: {<id>, <name>, <email>, <avatar>}, token: <Token JWT> } |
Code: 500 or 400 Content: { error: <A Message with a description of the Error> } |
/info | GET |
- | - | Code: 200 - OK Content: {<weight>, <height>, <IMC>} |
Code: 500 or 400 Content: { error: <A Message with a description of the Error> } |
/ | PUT |
{<Fields to update>} |
- | Code: 200 - OK Content: { message: <A Message of success>, token: <Token JWT> } |
Code: 500 or 400 Content: { error: <A Message with a description of the Error> } |
/ | DELETE |
- | - | Code: 200 - OK Content: { message: <A Message of success> } |
Code: 500 or 400 Content: { error: <A Message with a description of the Error> } |
- This is the route that you can update your password
ENDPOINT | Method | Body | URL Params | Success Response | Server Error Response |
---|---|---|---|---|---|
/ | PUT |
{ <password>, <newPassword> } |
- | Code: 200 - OK Content: { user: {<email>, <password>}, token: <Token JWT> } |
Code: 500 or 400 Content: { error: <A Message with a description of the Error> } |
ENDPOINT | Method | Body | URL Params | Success Response | Server Error Response |
---|---|---|---|---|---|
/ | GET |
- | - | Code: 200 - OK Content: [ {<id>, <title>, <date>}, {<id>, <title>, <date>}, ... ] |
Code: 500 or 400 Content: { error: <A Message with a description of the Error> } |
/ | POST |
{<title>, <date>} |
- | Code: 200 - OK Content: { message: <A Message of success> } |
Code: 500 or 400 Content: { error: <A Message with a description of the Error> } |
/ | DELETE |
- | id | Code: 200 - OK Content: { message: <A Message of success> } |
Code: 500 or 400 Content: { error: <A Message with a description of the Error> } |
ENDPOINT | Method | Body | URL Params | Success Response | Server Error Response |
---|---|---|---|---|---|
/ | GET |
- | - | Code: 200 - OK Content: [ {<id>, <title>, <day_of_week>, <loop>, <delay_time>}, ... ] |
Code: 500 or 400 Content: { error: <A Message with a description of the Error> } |
/ | POST |
{<id>, <title>, <day_of_week>, <loop>, <delay_time>} |
- | Code: 200 - OK Content: { message: <A Message of success> } |
Code: 500 or 400 Content: { error: <A Message with a description of the Error> } |
/ | DELETE |
- | id | Code: 200 - OK Content: { message: <A Message of success> } |
Code: 500 or 400 Content: { error: <A Message with a description of the Error> } |
ENDPOINT | Method | Body | URL Params | Success Response | Server Error Response |
---|---|---|---|---|---|
/ | GET |
- | - | Code: 200 - OK Content: [ {<id>, <title>, <date>}, {<id>, <title>, <date>}, ... ] |
Code: 500 or 400 Content: { error: <A Message with a description of the Error> } |
/ | POST |
{<title>, <date>} |
- | Code: 200 - OK Content: { message: <A Message of success> } |
Code: 500 or 400 Content: { error: <A Message with a description of the Error> } |
/ | DELETE |
- | id | Code: 200 - OK Content: { message: <A Message of success> } |
Code: 500 or 400 Content: { error: <A Message with a description of the Error> } |
ENDPOINT | Method | Body | URL Params | Success Response | Server Error Response |
---|---|---|---|---|---|
/error | GET |
- | - | Code: 200 - OK Content: <log file> |
Code: 500 or 400 Content: { error: <A Message with a description of the Error> } |
/info | GET |
- | - | Code: 200 - OK Content: <log file> |
Code: 500 or 400 Content: { error: <A Message with a description of the Error> } |
/debug | GET |
- | - | Code: 200 - OK Content: <log file> |
Code: 500 or 400 Content: { error: <A Message with a description of the Error> } |
- Id -
[Integer]
- Name -
[String]
- Email -
[String]
- Password -
[String]
- Exercises -
[Exercise]
- Weight -
[Weight]
- Height -
[Height]
- Id -
[Integer]
- Title -
[String]
- Date -
[String]
- User_ID -
[Integer]
- Id -
[Integer]
- Title -
[String]
- Date -
[String]
- User_ID -
[Integer]
- Id -
[Integer]
- Title -
[String]
- Day_of_week -
[String]
- Loop -
[String]
- Delay_time -
[String]
- User_ID -
[Integer]
- Id -
[Integer]
- Data -
[Longtext]
- User_ID -
[Integer]
- Id -
[Integer]
- Expires_in -
[Integer]
- User_ID -
[Integer]
- - SignUp
- - SignIn
- - Forgot Password
- - Update User
- - Update Password
- - Generate backup
- - Restore backup
- Create New Weight
- Delete Weight
- List Weight
- Create New Height
- Delete Height
- List Height
- Create New Exercise
- Delete Exercise
- List Exercise
- List End Weight, End Height
- Edit Profile
- Calculate IMC
- NodeJS - Build the project
- TypeScript - Language that Build the project
- express - Router of the Application
- bcryptjs - Module for encode the password in a hash
- cors - Middleware for provide connection
- jsonwebtoken - Encode and Decode JWT
- dayJS - Parsing, validating, manipulating, and formatting dates
- nodemailer - Module for send email
- prisma - Database ORM
- postgresql - Database
- docker-compose - DevOps Database virtual environment
This README was based in README