An API where only authenticated users can make jobs CRUD operations
- Create .env file in the root folder, then add MONGO_URI and JWT_SECRET
- Then run
npm install && npm start
- MVC Structure
- Register User
- Validate name, email, password with Mongoose
- Hash password (with bcryptjs)
- Save user
- Generate token
- Send response with token
- Login user
- Validate email, password in controller
- If email or password is missing, throw BadRequestError
- Find user
- Compare passwords
- If no user or password does not match, throw UnauthenticatedError
- If correct, generate token
- Send response with token
- Handling Validation Errors / Duplicate (Email) / Cast Error
- Using Cors and Some Security Packages
- cors
- helmet
- xss-clean
- express-rate-limit
- APImatic / Swagger UI for the docs