The aim of this project was to create a chat room for friends! We had two 4-hour sessions to complete this project! The objectives were the following:
๐ฆ๐ป Project objective for the user experience
โ
Allow users to create an account
โ
Allow users to login / logout
โ
Allow users to know who is logged in
โ
Allow users to retrieve conversation history with another user
โ
Allow users to open a conversation with another user
๐ ๏ธ Project objective at technical implementation level
โ
Using Node.js for the application structure
โ
Use MongoDB for data storage
โ
Use socket.io for interaction management
โ
Have a fault tolerant application (use of Replicaset)
โ
Unit testing with Node.js
When the user arrives on our application, he has the possibility to log in (left image), or to create an account (right image).
When the user logs in, an example conversation is visible, to explain very quickly what is possible in our project
The different users who are connected (indicated with the "online" at the top left), can communicate
To find out more and try out all the features, it's best to try out our application!
1๏ธโฃ Clone the Git
2๏ธโฃ Modify the configuration file to match your environment (in the configuration file here)
{
"db": {
"host": "127.0.0.1",
"port": 27017,
"name": "chat"
},
"sessionSecret": "123soleil",
"redis": {
"host": "127.0.0.1",
"port": 6379,
"password": ""
}
}
3๏ธโฃ Install the packages
yarn or npm install
4๏ธโฃ Start MongoDB using replicaset (optional)
If you have problems with the replicaset, you can simply follow step 8๏ธโฃ
mongod --replSet rs0 --port 27017 --dbpath ./data/r0s1
mongod --replSet rs0 --port 27018 --dbpath ./data/r0s2
mongod --replSet rs0 --port 27019 --dbpath ./data/r0s3
5๏ธโฃ Start the arbiter (optional)
mongod--port 30000 --dbpath ./data/arb --replSet rs0
6๏ธโฃ Defind roles of mongod servers (optional)
mongo --port 27017
7๏ธโฃ Last step to complete the configuration (optional)
rs.initiate()
rs.conf()
rs.add("localhost:27018")
rs.add("localhost:27019")
rs.addArb("localhost:30000")
8๏ธโฃโ Step to follow only in case of a problem with the replicat set
rmdir /S data
mkdir data
9๏ธโฃYou can now start the services !
open redis-server.exe from the source file
node server.js
1๏ธโฃ0๏ธโฃ It's time to have fun, go to localhost:3000
npm run test
- PERROLLAZ Maverick alias @M4verickFr
- CAULLIREAU Dorian alias @caullird