Skip to content

Instantly share code, notes, and snippets.

@shiqimei
Last active May 12, 2020 20:50
Show Gist options
  • Save shiqimei/ffebbed452f256a3b8cb00c1d99127b8 to your computer and use it in GitHub Desktop.
Save shiqimei/ffebbed452f256a3b8cb00c1d99127b8 to your computer and use it in GitHub Desktop.
const http = require('http');
http.createServer((req, res) => {
cosnt data = [];
req.on('data', chunk => data.push(chunk));
req.on('end', () => {
try {
console.log(JSON.parse(data));
catch(err) {
console.log(data.toString());
}
});
}).listen(4000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment