Created
November 9, 2015 19:53
-
-
Save baniol/092660a604fb139227f7 to your computer and use it in GitHub Desktop.
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
var http = require('http'); | |
var httpOptions = { | |
host: 'http://api.icndb.com/jokes', | |
// host: 'http://www.wp.pl', | |
path: 'random' | |
}; | |
http.get(httpOptions, requestHandler); | |
function requestHandler(req) { | |
var body = ''; | |
req.on('data', data => body += data); | |
req.on('end', () => console.log(body)); | |
} |
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
{ | |
"name": "chuck_cow", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment