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.js
- Invoke in index.js
Routers
- index.js
- auth.js
- job.js
Register User
- Validate - name, email, password - with MongoDB
- Hash Password (by bcrypy)
- Save user
- Generate Token (by JWT)
- Send response with Token
Login User
- 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, generate Token
- Send Response with Token
Job
- Validate - company, position
- Expect get all job, you can get paginate and sort by parameters page and sort
Security
- helmet
- cors