- API for an ecommerce site
- Its deployed on render
- CI/CD with Github Actions, deploys and releases tag on succes
- Install packages
npm install- Run the dev server
npm run dev- For linting,fixing linting and test coverage, refer to scripts in the package.json file
- Import connect.js
- Invoke in start()
- Setup .env in the root
- Add MONGO_URI with correct value
- auth
- gifts
- users
- authentication
- error-handler for Validation Errors, Duplicate ,Cast Error and other errors
Extra Tasks done in the model
- Password hashing
- Token creation
- Comparing password with bcrypt
- Default role is user
- Validate - name, email and password - with Mongoose
- Hash Password (with bcryptjs)
- Save User
- Generate Token
- Send Response with Token
- 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
- helmet
- cors
- xss-clean
- express-rate-limit