Express generator is a tool that helps quickly generate your application skeleton.
Preparation
- Have Node.js with npm installed
Installation
npm install express-generator -g
Now if you type express -h
, you’re able to get the help list below.
One Step Generation
express myapp
This command will simply generate the application folder called myapp
for you by default config. After having done this, you can:
cd myapp && npm install
npm start
- Open your browser, type
localhost:3000
, you can see the server is running
Customize Config
express myapp --hogan -c less
This command shows we use a template called hoganJS
, and install Less as a middleware of CSS.
Pay attention: the newest express generator recommand us to use
--view=templateName
to replace--templateName
, but actually, the key point that leads to success or fail depends on which template you pick. For instance, you can useexpress myapp --view=jade
; but you have to useexpress myapp --hogan
instead. For more info, check the instruction by typingexpress -h
.
-
上一篇
Unable To Manipulate MongoDB Due To Unproperly Closed Terminal? -
下一篇
My playing and singing -- [活着]