Hello World.js


From: http://nodejs.org/api/synopsis.html


An example of a web server written with Node which responds with 'Hello World':
var http = require('http');
http.createServer(function (request, response) {
        response.writeHead(200, {'Content-Type': 'text/plain'});
        response.end('Hello World\n');
console.log('Server running at');

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

> node example.js

Server running at

All of the examples in the documentation can be run similarly.

Link: http://www.asm32.net/article_details.aspx?id=6101

浏览次数 0 发布时间 2014-01-29 23:55:41 从属分类 node.js 【评论】【 】【打印】【关闭
| www.asm32.net | 2006版 | 资料中心 | linux | asm/asm32 | C/C++ | VC++ | java | Python | 书签 | ASP.Net书签 | 京ICP备09029108号-1