Last active
May 12, 2020 20:50
-
-
Save shiqimei/ffebbed452f256a3b8cb00c1d99127b8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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