Node.js核心模块-----http

http-----服务器模块

可以使用http模块创建服务器

var http=require("http");

创建服务 req为请求对象 res为相应对象 listen后的参数为设置的端口号 范围为0-65535

http.createServer(function(req,res){
		if(req.url=="/"){
			res.end()  //展示信息
		}
}).listen(3000)

猜你喜欢

转载自blog.csdn.net/ThroughWeb/article/details/88741643