使用express生成一个空白网站
express命令的使用
Usage: express [options]
Options:
-h, --help output usage information
-V, --version output the version number
-s, --sessions add session support
-e, --ejs add ejs engine support (defaults to jade)
-J, --jshtml add jshtml engine support (defaults to jade)
-h, --hogan add hogan.js engine support
-c, --css add stylesheet support (less|stylus) (defaults to plain css)
-f, --force force on non-empty directory
生成网站
$ express myapp
create : myapp
create : myapp/package.json
create : myapp/app.js
create : myapp/public
create : myapp/public/javascripts
create : myapp/public/images
create : myapp/public/stylesheets
create : myapp/public/stylesheets/style.css
create : myapp/routes
create : myapp/routes/index.js
create : myapp/views
create : myapp/views/layout.jade
create : myapp/views/index.jade
install dependencies:
$ cd myapp && npm install
run the app:
$ node app
按照提示执行命令就可以了。打开http://localhost:3000/ 显示的是views/index.jade文件,有两行express的简短文字宣告。