socket.io+angular.js+express.js做个聊天应用(一)
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
debug@0.7.4 node_modules/debug static-favicon@1.0.2 node_modules/static-favicon ejs@0.8.8 node_modules/ejs morgan@1.0.1 node_modules/morgan └── bytes@0.3.0 cookie-parser@1.0.1 node_modules/cookie-parser ├── cookie@0.1.0 └── cookie-signature@1.0.3 body-parser@1.0.2 node_modules/body-parser ├── qs@0.6.6 ├── type-is@1.1.0 (mime@1.2.11) └── raw-body@1.1.6 (bytes@1.0.0) express@4.0.0 node_modules/express ├── methods@0.1.0 ├── utils-merge@1.0.0 ├── merge-descriptors@0.0.2 ├── parseurl@1.0.1 ├── escape-html@1.0.1 ├── cookie-signature@1.0.3 ├── range-parser@1.0.0 ├── qs@0.6.6 ├── buffer-crc32@0.2.1 ├── fresh@0.2.2 ├── cookie@0.1.0 ├── path-to-regexp@0.1.2 ├── type-is@1.0.0 (mime@1.2.11) ├── send@0.2.0 (mime@1.2.11) ├── accepts@1.0.0 (mime@1.2.11, negotiator@0.3.0) └── serve-static@1.0.1 (send@0.1.4)
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
可关注。之后会不断更新。