A chat app server written in Javascript!
The server runs in node.js using Express to setup a server to listen to requests to API endpoints and /resetpassword
route. It uses socket.io to setup realtime communication for chat messaging.
- Sets up middleware for Rate Limiting & Body Parser (used for JSON).
- Connects to the MongoDB using Mongoose for CRUD operations.
- Express server to serve API endpoints &
/resetpassword
webpage - Connects socket.io to Express server to enable realtime bidirectional communication for chat messaging functionality.
I've created a Free tier MongoDB account using MongoDB Atlas.
The below endpoints are moved to the repo chat-server-lambda as I've split it into AWS Lambda function!
/login
: For login of users./register
: To register new users./forgotpassword
: To send a reset mail to the registered email address of the user./resetpassword
: To handle reset password functionality.
The /resetpassword
POST Request is handled by sending the /resetpassword/index.html
webpage back to the user, where they can enter relevant details to reset the password.
A mail is triggered to the user with the nodemailer package, you will need to setup your existing email Id for this. Or you can create a new one. You have to create a 'app password' (Gmail/Yahoo/etc.. each have their own way of generating app passwords, please consult the relevant documentation as per your requirements) and use it to send mails!
Have fun with the code!