2020/1/19 nodejs简单学习(关于GET/POST)
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)
相关推荐
fm00 2019-11-01
kaikai 2018-11-28
webgm 2020-08-16
yezitoo 2020-06-06
lei0 2020-11-02
igogo00 2020-07-04
iconhot 2020-06-26
88481456 2020-06-18
疯狂紫萧 2020-06-16
SelinaChan 2020-05-15
luckymaoyy 2020-04-25
80437700 2020-04-17
austindev 2020-04-07
我有一只小松鼠 2020-02-29
webfullStack 2020-02-15
binglingnew 2012-10-03
jinxiutong 2020-01-04
Dawnworld 2019-12-23