Created
May 12, 2020 20:47
-
-
Save shiqimei/ae016f4ff324825f079190c4781998c9 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