/NodeExpressTutorial

A tutorial for Node and Express.

Primary LanguageJavaScriptMIT LicenseMIT

Node Express Tutorial

A simple tutorial tutorial to get your feet wet with Node and Express.

Setup

NOTE: it is expexted that you already have Node and npm setup on your machine

Get Express Generator

Express Generator is an application scaffolding tool published by the folks behind Express. Install it gloabally using the following command: npm install -g express-generator

Scaffold an Application

To make use of the newly installed generator, you will call the command express. You can pass options and a directory name as follows: express [options][dir]. The Getting Started guide shows all the possible options. In this case we will use the following command: express -v hbs express-example. This will scaffold an application in the express-example directory that makes use of Handlebars as the view engine.

Helpful Tools

Nodemon

Nodemon monitors your application for changes and will automatically restart the server when a change is detected. This prevents you from having to constantly restart your server manually - a huge time saver! To install Nodemon globally, run the following command: npm install -g nodemon

With an application scaffolded with Express Generator you can simply call nodemon from the root directory of your project, no need to pass any arguements.