Simple chat application demo using node,express,ejs,sequelize-ORM,mysql.
$ npm install
$ npx sequelize-cli db:migrate //To migrate user table
-First go to config folder and open config.json file. -Add your database credentials in this code below: "development": { "username": "root", //Your username "password": null, //Password if any "database": "chatApplication", //Database name "host": "127.0.0.1", //Your host name "dialect": "mysql", "logging":false //Remove this option if you want to log queries running in background },
# Start the server
$ npm run dev
Project will start on port 4000 on localhost (http://localhost:4000).
No tests included this time. Just playing around with the framework.
As the project is running on localhost open any browser with normal and incognito tabs. Login with different ids on both tabs.
The project contain for functionality as given below.
-Login & Registration for users. -User status changes to green on login and red on disconnection. -Select and chat with online users only. -No user logout button but on tab close user will be logged out. -Make user offline on disconnection.
To create user you need to pass email,name,password in body of API (http://localhost:4000/register). Multiple user can not be created with same email.
For login you need to pass email and password in body of API (http://localhost:4000/login).
Select any user from the list and chat history will load
Type message to the selected user and message will be sent.