nodeJS 之 hello world!

var http = require('http');
function onRequest(resquest, response){
        response.writeHeader(200, "Conten-Type":"text/html");
        response.write('hello world');
	response.end();
}
http.createServer(onRequest).listen(8080);

下载nodesJS,windows下执行cmd,进入helloworld.js所在目录,执行node helloworld.js。 html

则服务器已经启动,浏览器访问localhost:8080,便可在浏览器上显示hello world; node

相关文章
相关标签/搜索