标签:url nbsp let console end bsp utf-8 服务 demo
1、Demo.js
let http = require(‘http‘);
let url = require("url");
let util = require("util")
let server = http.createServer((req,res)=>{
res.statusCode = 200;
res.setHeader("Content-Type","text/plain;charset=utf-8");
res.end( util.inspect( url.parse(req.url))); //将url信息以字符串形式输出 inspect 用于调试
}).listen(3000,"127.0.0.1",()=>{
console.log("服务器已经运行,请输入浏览,输入http://127.0.0.1:3000 来访问")
})
2、 node Demo.js
标签:url nbsp let console end bsp utf-8 服务 demo
原文地址:http://www.cnblogs.com/myRain/p/7799720.html