Production project: https://follow-up.onrender.com
First project created during Alura level-up program for the company Lina Open X.
Project developed during weeks 1 and 5 of the bootcamp.
- Node v14.18.1 or higher.
- Npm v6.14.15 or higher.
- MongoDb v6.0.2 or higher.
-
Clone the repository using git bash:
git clone https://github.com/RichardRosenblat/follow-up.git
-
Access the application folder:
cd follow-up
-
Install the depedencies:
npm install
-
Create a
.env
file and insert the specific configurations for the application to run on your device:# The port in which the aplciation will listen to PORT = 3000 # The connection string for your MongoDb server CONNECTIONSTRING = "mongodb://localhost:27017" # The database in your MongoDb server in which the application will operate DATABASENAME = "follow-up"
-
Start the project using the npm commands:
npm start
ou
npm run start:dev
- GET /users
- Responses:
- Status:
200 OK
-
Body:
[ { "id": "6374e42c0429fc93f850f468", "name": "Richard Rosenblat", "email": "imadethis@code.com", "password": "$2b$10$ullU5sGQ/gRLcac5MeB7aOxCknUCh6.rjW1.mhbXeTKCVR2cXbkCe", "creationDate": "2022-11-16" } ]
-
- Status:
- GET /users/:id
- Responses:
-
Status:
200 OK
-
Body:
{ "id": "6374e42c0429fc93f850f468", "name": "Richard Rosenblat", "email": "imadethis@code.com", "password": "$2b$10$ullU5sGQ/gRLcac5MeB7aOxCknUCh6.rjW1.mhbXeTKCVR2cXbkCe", "creationDate": "2022-11-16" }
-
-
Status:
404 NOT FOUND
-
Body:
[ { // Field in which this error is related to. "field": "id", // A especification of the error. "message": "Id must exist in database" } ]
-
-
-
POST /users
-
Request Body:
{ "name":"Richard Rosenblat", "email": "imadethis@code.com", "password": "1234567890" }
-
-
Responses:
-
Status:
201 CREATED
-
Body:
{ "id": "6374e42c0429fc93f850f468", "name": "Richard Rosenblat", "email": "imadethis@code.com", // This field is encripted automatically. "password": "$2b$10$ullU5sGQ/gRLcac5MeB7aOxCknUCh6.rjW1.mhbXeTKCVR2cXbkCe", "creationDate": "2022-11-16" }
-
-
Status:
400 BAD REQUEST
-
Body:
[ { // Field in which this error is related to. "field": "name", // A especification of the error. "message": "Name cannot be empty" }, { // Field in which this error is related to. "field": "id", // A especification of the error. "message": "Id must exist in database" } { "field": "email", "message": "Email must be unique" } ]
-
-
-
PUT /users/:id
-
Request Body:
{ "password":"1234567890" }
-
-
Responses:
-
Status:
201 CREATED
-
Body:
{ "id": "6374e42c0429fc93f850f468", "name": "Richard Rosenblat", "email": "imadethis@code.com", // This field is encripted automatically "password": "$2b$10$ullU5sGQ/gRLcac5MeB7aOxCknUCh6.rjW1.mhbXeTKCVR2cXbkCe", "creationDate": "2022-11-16" }
-
-
Status:
400 BAD REQUEST
-
Body:
[ { // Field in which this error is related to. "field": "id", // A especification of the error. "message": "Id must exist in database" }, { "field": "password", "message": "Password must be minimum 8 caracters" } ]
-
-
-
Delete /users/:id
-
Responses:
- Status:
204 NO CONTENT
- Status:
404 NOT FOUND
-
Body:
[ { // Field in which this error is related to. "field": "id", // A especification of the error. "message": "Id must exist in database" } ]
-
- Status:
- GET /
- Responses:
- Status:
200 OK
-
Body:
{ "Server": "ok", "Database": "Connected" }
-
- Status:
To test the application you can run the following commands
-
Run all test suites
npm run test
-
Run all test suites in watch mode
npm run test:watch
-
Generate coverage reports
npm run test:cov
- NodeJs
- MongoDB
- NPM
- MongoDB's NodeJs driver
- Bcrypt
- Dotenv
- Express
- Validator
- Nodemon
- Jest