node(1) hello world

 1 //一 使用require指令来载入http模块
 2 var http = require('http');
 3 //二使用http.createServer()的方法创建服务器
 4 http.createServer(function(request,response){
 5    //发送HTTP头部
 6    //HTTP状态值:200 
 7    //内容类型:text/plain
 8    responsed.writeHead(200,{'Content-type':'text/plain'});
 9 
10    //发送响应数据 “Hellow world”
11    response.end('hellow world');    
12 }).listen(3000,"127.0.0.1");

猜你喜欢

转载自www.cnblogs.com/webmc/p/9432688.html