标签:push 请求 接收 关于 cat pat parse result ons
const http = require(‘http‘) const url = require(‘url‘) const querystring = require(‘querystring‘) http.createServer((require,response)=>{ // GET请求 let {pathname,query}=url.parse(require.url,true) console.log(pathname,query) // POST请求 let result = [] require.on(‘data‘, (buffer) => { result.push(buffer) }) require.on(‘end‘, () => { let data = Buffer.concat(result).toString// toString是因为已知是接收帐号密码 console.log(querystring.parse(data)) }) }).listen(8080)
2020/1/19 nodejs简单学习(关于GET/POST)
标签:push 请求 接收 关于 cat pat parse result ons
原文地址:https://www.cnblogs.com/foreversimon/p/12215567.html