1# You can run the application generator with the npx command (available in Node.js 8.2.0).
2$ npx express-generator
3# For earlier Node versions, install the application generator as a global npm package and then launch it:
4$ npm install -g express-generator
5# For example, the following creates an Express app named myapp. The app will be created in a folder named myapp in the current working directory and the view engine will be set to Pug:
6$ express --view=pug myapp
7
8 create : myapp
9 create : myapp/package.json
10 create : myapp/app.js
11 create : myapp/public
12 create : myapp/public/javascripts
13 create : myapp/public/images
14 create : myapp/routes
15 create : myapp/routes/index.js
16 create : myapp/routes/users.js
17 create : myapp/public/stylesheets
18 create : myapp/public/stylesheets/style.css
19 create : myapp/views
20 create : myapp/views/index.pug
21 create : myapp/views/layout.pug
22 create : myapp/views/error.pug
23 create : myapp/bin
24 create : myapp/bin/www
25# Then install dependencies:
26$ cd myapp
27npm install
28# On MacOS or Linux, run the app with this command:
29$ DEBUG=myapp:* npm start
30# On Windows Command Prompt, use this command:
31$ set DEBUG=myapp:* & npm start
32# On Windows PowerShell, use this command:
33$env:DEBUG='myapp:*'; npm start
1## Command
2$ npx express-generator
3
4: 'For earlier Node versions, install the application generator as a global
5npm package and then launch it':
6$ npm install -g express-generator
7$ express
8
9## Display the command options with the -h option:
10$ express -h
1$ express -h
2
3 Usage: express [options][dir]
4
5 Options:
6
7 -h, --help output usage information
8 --version output the version number
9 -e, --ejs add ejs engine support
10 --hbs add handlebars engine support
11 --pug add pug engine support
12 -H, --hogan add hogan.js engine support
13 --no-view generate without view engine
14 -v, --view <engine> add view <engine> support (ejs|hbs|hjs|jade|pug|twig|vash) (defaults to jade)
15 -c, --css <engine> add stylesheet <engine> support (less|stylus|compass|sass) (defaults to plain css)
16 --git add .gitignore
17 -f, --force force on non-empty directory