Our React front-end uses an Express-JS backend to handle requests for user registration and login. For our database we are using a NO-SQL mongoDB.
If you do not have NodeJS installed:
sudo apt update && sudo apt install nodejs npm
# use npm to install latest node
sudo npm install -g n && sudo n stable
# replace old nodejs for new nodejs
$oldNode = $(which nodejs)
sudo rm -rf $oldNode
sudo ln -s $(which node) $oldNodeYou will need to install NodeJS dependencies to run the server.js, chat.js, and the React front-end:
cd discord_clone
# install dependencies from packages.json
npm install .If you do not have Docker installed:
sudo apt update && sudo apt install docker.ioIf you do not have a mongodb Docker installed:
# create custom mongo docker image from Dockerfile
sudo docker build -t mongo_hic .
# run the docker
sudo docker run --name mongodb -d -p 27017:27017 mongo_hic
# if the docker is down
sudo docker start mongodb
# to interact with the docker directly
sudo docker exec -it mongodb /bin/bashOnce you've installed all dependencies:
# start the expressJS backend
nodejs ./src/backend/server.js
# start the Socket.IO backend
nodejs ./src/backend/chat.js
# start the react app
npm start# Stops the docker container
sudo docker stop mongodb
# Removes the docker container
sudo docker rm mongodb
# Removes the docker image
sudo docker rmi mongo_hic