This is my second NodeJS server and a code challenge from a class in Rocketseat's Bootcamp. The challenge involves creating a REST API server with an authentication service from scratch with nodejs. Read Description
Build an authentication service from scratch using Express, Nodemon, Sequelize, Jsonwebtoken, Yup and Postgres. In this application I used linting standards with ESLint + Prettier + EditorConfig.
-
GET /
: This is a test route you can send as response anOK
message. -
POST /users
: This route creates a new user and must receivename
,email
andpassword
in the body. You must validate the user where you state that all fields are required,email
must be an email and password has a minimum of 8 characters. -
POST /sessions/
: This route logs the user into the application and receivesemail
andpassword
as mandatory fields. -
PUT /users
: This route updates the authenticated user and receives any of the followingname
,email
orpassword
in the body.
On loging in and creating a user uncrypt their password using JWT to create an encrypted token. Create a middleware that validades if a user is authenticated, use JWT to decode the user's token.
To run the application first install dependencies
yarn or npm install
This application uses Postgres so make sure to have that running (with Docker recommended) then run the application
yarn dev
Your code should be up and running here
http://localhost:3333
Check out the continuation of this challenge here.
This project is made available under the MIT LICENSE.