Last active
February 27, 2018 06:14
-
-
Save yingmu52/f4f711c7d325fa7e2ac2ab7b4feb780e to your computer and use it in GitHub Desktop.
http node
This file contains 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 https = require('https'); | |
https.get('https://jsonplaceholder.typicode.com/posts/1', (resp) => { | |
let data = ''; | |
resp.on('data', (chunk) => { | |
data += chunk; | |
}); | |
resp.on('end', () => { | |
console.log(data) | |
}); | |
}).on("error", (err) => { | |
console.log("Error: " + err.message); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment