1,269   ExpressJS NodeJS

框架的作用是不用重复造轮子,将精力放在业务逻辑上!

Express 是 Node.JS 比较流行的框架,包含基本的类库,同时提供了express-generator工具,创建web项目更简单了!官网地址:http://expressjs.com/en

1,安装express-generator工具,

npm install express-generator -g

2,测试命令

D:\code\testnode>express -h

  Usage: express [options] [dir]

  Options:

...............

D:\code\testnode>

3,创建web项目

express myExpressApp

   create : myExpressApp
   create : myExpressApp/package.json
   create : myExpressApp/app.js

...............

4,加载类库

$ cd myExpressApp
$ npm install

5,运行web项目

D:\code\myExpressApp>SET DEBUG=myExpressApp:* & npm start

> myExpressApp@0.0.0 start D:\code\myExpressApp
> node ./bin/www

  myExpressApp:server Listening on port 3000 +0ms


6,浏览器打开http://localhost:3000

 

QQ图片20151207211235



Leave a Reply

Your email address will not be published. Required fields are marked *