Tech Stack: Node JS, Express JS Authentication: JSON Web Tokens DB used: MongoDB Sensitive variables are stored in a .env file which is not uploaded in this repo.
This application is tested on POSTMAN and the screenshots of the same are provided below.
Signup: when a user signup the DB is checked for existing username and email if the user does not exits then a new user is created along with a JWT along with a payload that will expire in 24 hours.
Login route: when a user tries to login the credentials are verified and a JWT is created along with a payload that will expire in 24 hours.
User route: After logging in a user can view its information by passing the token a header 'x-auth-token'.
Logout route: Since JWT cannot be destroyed or expired manually on the server side. A message is displayed 'you are logged out'