```
let http = require('http');
let server = http.createServer(function(req,res){
console.log('ok');
let contentType = req.headers['content-type'];
let buffers = [];
req.on('data',function(chunk){
buffers.push(chunk);
})
req.on('end',function(){
// console.log(JSON.parse(Buffer.concat(buffers).toString()).name);
let content = Buffer.concat(buffers).toString();
if(contentType === 'application/json'){
console.log(JSON.parse(content).name);
}else if(contentType === 'application/x-www-form-urlencoded'){
let queryString = require('querystring');
console.log(queryString.parse(content).name);
}
})
res.end();
});
server.listen(4000);
```