In this assignment, you will continue to enhance your REST API application from the previous task.
- Implement an authentication mechanism in your application.
- Implement authorization using JWT tokens, ensuring that all operations with contacts are performed only by registered users.
- Users should only have access to their own contacts and operations.
- Implement a mechanism for verifying the email address of registered users.
- Limit the number of requests to the /me route.
- Enable CORS for your REST API.
- Add functionality for users to update their avatar (use the Cloudinary service for this feature).
- During registration, if a user with the provided
emailalready exists, the server should return anHTTP 409 Conflicterror. - The server must hash passwords and never store them in plain text in the database.
- Upon successful user registration, the server should respond with an
HTTP 201 Createdstatus and include the new user’s data. - For all
POSToperations (creating new resources), the server must return anHTTP 201 Createdstatus. - For POST requests requiring user authentication, the server should accept the user’s credentials (username and password) in the request body.
- If the user does not exist or the password is incorrect, the server should return an
HTTP 401 Unauthorizederror. - Authorization using
JWTtokens must be implemented through anaccess_token. - All environment variables must be stored in a
.envfile. Sensitive data should not be hardcoded directly in the code. - Use Docker Compose to run all services and databases in the application.