SHARE
TWEET

getJokesJson-v1

SivaNach Jul 21st, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. router.get('/getJokesJson', function(request, response){
  2.        httpRequest({
  3.             headers: {
  4.                 'Accept': 'text/plain'
  5.             },
  6.             uri: 'https://icanhazdadjoke.com/',
  7.             method: 'GET'
  8.         }, function (error, httpResponse, body) {
  9.            //httpResponse.set('Content-Type', 'text/plain');
  10.               console.log('error:', error); // Print the error if one occurred and handle it
  11.               console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received
  12.               console.log(body);
  13.               return response.send(body);
  14.         });
  15.     });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top