March 23, 2018
In this series of tutorials we’ll be walking through how to create a basic Express application in Node JS.This tutorial will be covering just installing everything we need to get started. Here’s what we’ll need to install:
npm install -g nodemonfrom the command line. This will install the command “nodemon” for us to use during development later.
OK, on to setting up our actual project. Navigate to the location you’d like to create your project an issue the following commands from the command line:
mkdir node-express-tutorial npm init
This will create the directory to house our project as well as initialize the directory as an NPM project. You can just accept all the default values during creation. You’ll see a package.json file now in the directory which will contain most of the supporting information about our project such as packages we depend on.
Now let’s create a couple of directories to give some structure to this project. Even though you could very easily contain all the files in the root directory for a small project like this, it’s a good idea to get into the habit of cleanly organizing your projects since when they get larger it’ll matter a lot more. For now, let’s create these directories:
Now that we’ve got the directory structure setup, we’ll move on to writing some code!