Creating an ExpressJS app on a Mac

Step 1

Install Node from http://nodejs.org/

Step 2

This installs ExpressJS command-line tools.

npm install -g express

Step 3

These install tools to help you build an ExpressJS web app quickly.

npm install -g express-generator

Step 4

Create your first ExpressJS app on Desktop using Express Generator. We also set the view to be pug instead of the deprecated jade.

cd ~/Desktop
npx express-generator --view=pug [name of your app]

Step 5

Change directory into your new app

cd ./name/of/your/new/app

Step 6

Install all the necessary packages to build an ExpressJS app formally.

npm install

Step 7

Start your web server.

npm start

Step 8

Confirm the webserver is working on your browser
http://localhost:3000/

Step 9

Add a listener to the bottom of app.js

app.locals.pretty = true;
// all environments
app.set('port', process.env.PORT || 8080);

/* ** ** ** ** ** ** **
* App Server Listening
* ** ** ** ** ** ** **/
app.listen(app.get('port'), app.get('ipaddress'), function() {
      console.log("Node app is running at localhost:" + app.get('port'))
});

Step 10

I generally like to use nodemon server for development. Here's how to install it for development purposes.

npm install nodemon --save-dev