Tutorial: Node, Express, Mongo with Docker

Andy Hartnett
2 min readMar 29, 2021

Recently I have been working on building MySpace From Scratch and sharing my journey here on Medium. At the very beginning of that series I went over setting up the environment for the project. I realized that a lot of people get overwhelmed when working with Docker so I wanted to write down a clear guide on how to get your Node project up and running with Docker in a manner of minutes.

Let’s Get Started — Installing Packages

Create a new folder for your new project and navigate to that folder in your terminal/command line. Run the following commands to install all the npm packages we need

npm install express
npm install mongoose
npm install nodemon
npm install cors

The Code

Create a new file called server.js
Here is what should go in that file:

Next create a src directory where the rest of your application will go. the server.js will act as a gateway into your application, and your app will be contained in the src directory…

--

--