msn email google-talk twitter tumblr flickr

nodejs

似乎很有意思 mark一下 javascript真是潜力十足 这里推荐两本有帮助的书

<JavaScript学习指南>就是俗称地小犀牛书

还有

<JavaScript语言精粹>英文原书名叫<JavaScript: The Good Parts>封面上是一只蝴蝶 蝴蝶书?

Evented I/O for V8 JavaScript.

An example of a web server written in Node which responds with “Hello World” for every request.

   1      var http = require('http');
   2      http.createServer(function (req, res) {
   3        res.writeHead(200, {'Content-Type': 'text/plain'});
   4        res.end('Hello World\n');
   5      }).listen(8124, "127.0.0.1");
   6      console.log('Server running at http://127.0.0.1:8124/');

To run the server, put the code into a file example.js and execute it with the node program:

    % node example.js
    Server running at http://127.0.0.1:8124/

Here is an example of a simple TCP server which listens on port 8124 and echoes whatever you send it:

   1      var net = require('net');
   2      net.createServer(function (socket) {
   3        socket.setEncoding("utf8");
   4        socket.write("Echo server\r\n");
   5        socket.on("data", function (data) {
   6          socket.write(data);
   7        });
   8        socket.on("end", function () {
   9          socket.end();
  10        });
  11      }).listen(8124, "127.0.0.1");

See the API documentation for more examples.

http://github.com/ry/node_chat

http://nodejs.org/