- Node.js v0.11.11
- Express v3.5.2
- socket.io v0.9.16
- 画像を数枚準備 (今回は neko.jpg, inu.jpg, umi.jpeg, hana.jpg, fukuoka.jpg)
####Node.js + express + socket.io で画像を返すチャットルーム
今回はntwitterを使用。 https://github.com/AvianFlu/ntwitter ntwitterの中身については別途確認します
var server = http.createServer();
createServer
メソッドでhttp.Server
オブジェクトを作成http.Server
はクラスで、次のイベントを持つEvent Emitter
Event | 関数 |
---|
$ git clone [email protected]:tokunami/sample.git
Cloning into 'sample'...
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (4/4), done.
https://github.com/mikeal/request
$ npm install request
前回、requestを使って取得したhtmlから言葉を抜き出してみました
今回使用したのはcheerio→→ https://github.com/cheeriojs/cheerio
npm でインストール
$ npm install cheerio --save
--save
をつけるとpackage.jsonに反映してくれる
requestお試しメモ →→ https://gist.github.com/tokunami/d931b07aa123a4ba7b6a
cheerioお試しメモ →→ https://gist.github.com/tokunami/d6ad26ec40ed468d27a9