url

url.parse()

nodeJs 常用模块(一)

 

querystring

querystring.parse( [string] , [分隔符] )  ,解析为js字面量

nodeJs 常用模块(一)

nodeJs 常用模块(一)

querystring.stringify() ,将js对象转为字符串

nodeJs 常用模块(一)

querystring.escape() ,转译

 nodeJs 常用模块(一)

实际上浏览器上也有类似功能

nodeJs 常用模块(一)

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 })
View Code

相关文章: