Learn how to use the Express Generator to quickly setup an app.
Express.js is a fantastic web framework for new developers to get an app started quickly and it’s certainly one of the most popular frameworks available.
You can of course just add Express as a dependency to an existing project and start creating your own routes and templates etc. but there is a tool available, the Express Generator, which can build a skeleton project with routes and templates separated into their own folders .
Installing the Express Generator
Simply install the Express Generator as a global npm package:
npm install -g express-generator
Once installed, to use it simply call the command *express *with a project name from the terminal:
Passing options to Express Generator
There are a few options that you can pass to the Express Generator program:
express -h Usage: express [options] [dir] Options: -h, --help output usage information --version output the version number -e, --ejs add ejs engine support --hbs add handlebars engine support --pug add pug engine support -H, --hogan add hogan.js engine support --no-view generate without view engine -v, --view
add view support (ejs|hbs|hjs|jade|pug|twig|vash) (defaults to jade) -c, --css add stylesheet support (less|stylus|compass|sass) (defaults to plain css) --git add .gitignore -f, --force force on non-empty directory
The main ones being the templating engine you want to use to render templates for your routes.
Try them both out and see what you prefer.