const http = require('http');
const url = require('url');
const server = http.createServer((req, res) => {
//GET数据获取,直接获取
const urlStr = url.parse(req.url);
querystring.parse(urlStr.query);
//POST数据获取,从缓存区读取数据
var dataStr = '';
req.on('data',function(str){
dataStr += 'str';
});
req.on('end',function(str){
console.log(str);
});
res.end();
});
server.listen(8000);