本文共 482 字,大约阅读时间需要 1 分钟。
const http = require('http');const querystring = require('querystring');http.createServer((req,res)=>{       if(req.url.startsWith('/login')){           let pdata = '';        req.on('data',(chunk)=>{               pdata += chunk;        });        req.on('end',()=>{               let obj = querystring.parse(pdata);            res.end(obj.id+' ---- '+obj.name);        })    }}).listen(3000,()=>{       console.log('server is on!');})   postman测试时候要选x-www-form-urlencoded,不然会有其他信息出现
 
 转载地址:http://ontq.baihongyu.com/