/node-express-mongodb-app

πŸš€ REST API developed with JavaScript, Node.js, Express and MongoDB.

Primary LanguageJavaScriptMIT LicenseMIT

API REST with Node.js, Express and MongoDB

Status: finished βœ”οΈ

GitHub Last Commit License Stargazers

Run in Insomnia}

πŸ“‹ Index

πŸš€ About

This application was built using JavaScript, Node.js, Express and MongoDB with MVC architectural pattern. In this API was created routes for user registration using encrypted password which authenticates users by returning a JWT token to validate the login, with a feature that provides password recovery by email through Nodemailer.

πŸ—ΊοΈ Routes

User Authentication:

route HTTP Method params description
/auth/register POST Request body with name, email and password Register a user
/auth/authenticate POST Request body with email and password Authenticate a user
/auth/forgot_password POST Request body with email Sends a new access token to the email entered in the request body
/auth/reset_password POST Request body with email, token and password Reset the access password through the registered email and the access token provided by email on the /forgot_password route

Requests

  • POST: /auth/register
{
	"name": "Exemple",
	"email": "exemple@gmail.com",
	"password": "123456"
}
  • POST: /auth/authenticate
{
	"email": "exemple@gmail.com",
	"password": "12345678"
}
  • POST: /auth/forgot_password
{
	"email": "exemple@gmail.com"
}
  • POST: /auth/reset_password
{
	"email": "exemple@gmail.com",
	"token": "ebf60c2e5be235f96c0c0571c04fad1f843da9c7",
	"password": "1234567890"
}

CRUD Projects:

route HTTP Method params description
/projects GET - Lists the projects registered in the database
/projects/:projectId GET Query parameter with projectId Lists a specific project through it's id
/projects POST Request body with title, description and tasks Creates a new project
/projects/:projectId PUT Query parameter with projectId Updates a specific project through it's id
/projects/:projectId DELETE Query parameter with projectId Deletes a specific project through it's id

Requests

  • GET: /projects/5fd537a24c1f4316c1d21f2d

  • POST: /projects

{
	"title": "New Project Test 2",
	"description": "Project description Test",
	"tasks": [
		{
			"title": "New task Test 2",
			"assignedTo": "5fd537a24c1f4316c1d21f2d"
		},
		{
			"title": "Another task Test 2",
			"assignedTo": "5fd537a24c1f4316c1d21f2d"
		}
	]
}
  • PUT: /projects/5fd537a24c1f4316c1d21f2d

  • DELETE: /projects/5fd537a24c1f4316c1d21f2d

πŸ€– Technologies

The project was developed using this technologies:

βš™ How to Use

# Clone this repository

$ git clone https://github.com/cassiocappellari/node-express-mongodb-app.git

# Enter the project folder

$ cd node-express-mongodb-app

# Install the dependencies

$ npm install

# Start the project

$ node src/index.js

πŸ‘¨β€πŸš€ Author

CΓ‘ssio Cappellari

πŸ“ License

This project is under the MIT license.


Developed with πŸ’š by CΓ‘ssio Cappellari!