Project Setup
In order to spin up the project, in the root create .env with these two variable, with your own values. JWT_SECRET && MONGO_DB
Set up npm install && npm start
Database Connection
- Import connect
- Invoke in index.js
Routers
- index.js
- auth.js
- edit.js
- home.js
- trash.js
Register User
- Validate - name, email, password - with MongoDB
- Hash Password (by bcrypy)
- Save user
- Generate Token (by JWT)
- Send Token to Session
Login User
- Get session from token
- Validate - email, password - in Controller
- If email or password is missing, throw BadRequest
- Find User by email
- Compare password
- If no user or password does not match, throw UnauthenticatedError
- If correct, send token to session
Task
- Validate - name, time, date
- Get all task, edit, delete, create
Security
- helmet
- cors