socket.io+angular.js+express.js做个聊天应用

Posted Brenda

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了socket.io+angular.js+express.js做个聊天应用相关的知识,希望对你有一定的参考价值。

node,express开发环境等安装如果已经搞好了。


[email protected]:~/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">[email protected]:~/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])


[email protected]:~/projects/nodejs/chattingnode$ ls
app.js  bin  node_modules  package.json  public  routes  views

[email protected]:~/projects/nodejs/chattingnode$ node ./bin/www
GET / 200 10ms - 207b
GET /stylesheets/style.css 200 6ms - 110b



技术分享

项目源代码地址:https://github.com/edagarli/chattingnode


可关注。之后会不断更新。


以上是关于socket.io+angular.js+express.js做个聊天应用的主要内容,如果未能解决你的问题,请参考以下文章

socket.io+angular.js+express.js做个聊天应用

如何使用 Angular 和 Jasmine 模拟 socket.io

Socket.io聊天示例node.js需要

socket.io 发射在 socket.on 中不起作用

如何允许其他网络连接到服务器 nodejs socket io

带有 socket.io 的快递服务器不会发送给正确的收件人