node快速构建express项目

2018-08-16  本文已影响0人  微微下雨天
C:\Users\Administrator\Desktop>node -v
v6.9.5

C:\Users\Administrator\Desktop>npm -v
v3.10.10
C:\Users\Administrator\Desktop>npm install -g cnpm --registry=https://registry.npm.taobao.org
C:\Users\Administrator\Desktop>cnpm install express express-generator -g
C:\Users\Administrator\Desktop>express version
4.14.1
C:\Users\Administrator\Desktop>express --hbs myNode
 
  warning: option `--hbs' has been renamed to `--view=hbs'
 
 
   create : myNode
   create : myNode/package.json
   create : myNode/app.js
   create : myNode/public
   create : myNode/views
   create : myNode/views/index.hbs
   create : myNode/views/layout.hbs
   create : myNode/views/error.hbs
   create : myNode/routes
   create : myNode/routes/index.js
   create : myNode/routes/users.js
   create : myNode/bin
   create : myNode/bin/www
   create : myNode/public/javascripts
   create : myNode/public/stylesheets
   create : myNode/public/stylesheets/style.css
 
   install dependencies:
     > cd myNode && npm install
 
   run the app:
     > SET DEBUG=mynode:* & npm start
 
   create : myNode/public/images
C:\Users\Administrator\Desktop>cd myNode
 
C:\Users\Administrator\Desktop\myNode>

2)安装依赖,cmd在myNode路径下输入:cnpm install,会自动安装依赖文件。

C:\Users\Administrator\Desktop\myNode>cnpm install
√ Installed 7 packages
√ Linked 69 latest versions
√ Run 0 scripts
√ All packages installed (82 packages installed from npm registry, used 2s, speed 389.02kB/s, json 99(777.64kB), tarball 0B)
C:\Users\Administrator\Desktop\myNode>node bin/www
Listening on port 3000
C:\Users\Administrator\Desktop\myNode>node bin/www
Listening on port 3000
GET / 304 114.119 ms - -
GET /stylesheets/style.css 200 3.301 ms - 111
GET / 304 4.878 ms - -
GET /stylesheets/style.css 304 1.599 ms - -
访问express.png
上一篇下一篇

猜你喜欢

热点阅读