The application code
Here, I'll run through how I actually wrote the code deployed to the server
First, on the host machine, I needed a few libraries. From the node download page, I got npm which allowed me to install all subsequent libraries. The libraries I needed were: Express, Docker, and bcrypt, md5, and mongodb
To install docker, install the community edition on a computer running windows 1- pro, Linux, or MacOS. For the rest of the libraries run the following commands
$ npm install -g express
$ npm install -g md5
$ npm install -g mongo
$ npm install -g bcrypt
To initialize the project use
$ npm init
From here I started coding assuming that the application would be in the container. The code in the backend can be found here
In the folder I then ran the docker commands
# This specifies the tag that will be used for the docker container and the location to look for
$ sudo docker build -t guydw/eggchatbackend .
And then I pushed it up to the cloud using the docker push command
$ sudo docker push guydw/eggchatbackend
After this I could redeploy the code on the server
Last updated
Was this helpful?