Advertisement
SivaNach

getJokesJson-v1

Jul 21st, 2019
86
0
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.     });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement