I have implemented a GET request via request module in Nodejs in an application. I need to display the response over html page. However, the response returned is undefined. Also, error and body message is also undefined.
I tried running it seperately with "node file.js", it works fine. Do I have to add anything else while using it in application. I also tried htttp, curl-request and request-promise modules, all of them return undefined.
    var request  = require(['request']);
    var headers = {
            'Accept': 'text/json',
            'X-Auth-Token': tk,
            'User-Agent': 'request'
    };
    var options = {
            url: 'https://api.github.com/repos/request/request',
            headers: headers,
            method: 'GET',
            json: true
    };
    function callback(error, response, body){
            console.log(response);
            console.log(error);
          if (!error && response.statusCode == 200) {
                    console.log(body);
                    return body;
          }
    }
 request(options, callback);
 
     
    