node,express開發環境等安裝假設已經搞好了。
justhacker@justhacker-ThinkPad-Edge-E440:~/projects/nodejs$ express -e chattingnode
create : chattingnode
create : chattingnode/package.json
create : chattingnode/app.js
create : chattingnode/public
create : chattingnode/public/javascripts
create : chattingnode/public/images
create : chattingnode/public/stylesheets
create : chattingnode/public/stylesheets/style.css
create : chattingnode/routes
create : chattingnode/routes/index.js
create : chattingnode/routes/users.js
create : chattingnode/views
create : chattingnode/views/index.ejs
create : chattingnode/views/error.ejs
create : chattingnode/bin
create : chattingnode/bin/www
install dependencies:
$ cd chattingnode && npm install
run the app:
$ DEBUG=my-application ./bin/www
接着
<pre name="code" class="java">justhacker@justhacker-ThinkPad-Edge-E440:~/projects/nodejs/chattingnode$ cd chattingnode && npm install
[email protected] node_modules/debug
[email protected] node_modules/static-favicon
[email protected] node_modules/ejs
[email protected] node_modules/morgan
└── [email protected]
[email protected] node_modules/cookie-parser
├── [email protected]
└── [email protected]
[email protected] node_modules/body-parser
├── [email protected]
├── [email protected] ([email protected])
└── [email protected] ([email protected])
[email protected] node_modules/express
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
└── [email protected] ([email protected])
justhacker@justhacker-ThinkPad-Edge-E440:~/projects/nodejs/chattingnode$ ls
app.js bin node_modules package.json public routes views
justhacker@justhacker-ThinkPad-Edge-E440:~/projects/nodejs/chattingnode$ node ./bin/www
GET / 200 10ms - 207b
GET /stylesheets/style.css 200 6ms - 110b
項目源碼地址:https://github.com/edagarli/chattingnode
可關注。之後會不斷更新。