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