npm install && npm start
- Import connect.js
- Invoke in start()
- Setup .env in the root
- Add MONGO_URI with correct value
- auth.js
- items.js
- Validate - username, password - with Mongoose
- Hash Password (with bcryptjs)
- Save User
- Generate Token
- Send Response with Token
- Validate - username, password - in controller
- If username 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
- Validation Errors
- Duplicate (username)
- Cast Error
- helmet
- cors
- xss-clean
- express-rate-limit
Swagger UI
- Documentation can be found in "https://csgo-items--api.herokuapp.com/api-docs/"