O'Reilly logo

Node Cookbook Second Edition by David Mark Clements

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Generating Express scaffolding

Express works both as a Node module and as a command-line executable. The express-generator module (part of the Express project) provides an easy way to generate a project skeleton using its command-line tool (express).

Getting ready

We need to install express-generator using the -g flag (install globally) in order to run the subsequently installed express executable from any directory:

sudo npm -g install express-generator

We use sudo to ensure that we have appropriate permission to install globally. This doesn't apply with Windows or Mac OS X, so it should be run without sudo.

How to do it...

First, we decide upon the name of our app. Let's call it nca (Node Cookbook App) and simply run the following command:

express ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required