url
url.parse()
querystring
querystring.parse( [string] , [分隔符] ) ,解析为js字面量
querystring.stringify() ,将js对象转为字符串
querystring.escape() ,转译
实际上浏览器上也有类似功能
querystring.unscape() ,反转译
http:
开启一个web服务器
1 const http = require('http') 2 3 const port = 8080 4 const hostname = 'localhost' 5 6 const server = http.createServer((request, response)=>{ 7 response.writeHead(200, {'Content-Type': 'application/html'}) 8 response.write('<b>hellow</b>') 9 response.end() 10 }) 11 12 server.listen(port, hostname, ()=>{ 13 console.log(`server runing at http://${hostname}:${port}`) 14 })