I'm new to node JS, Here I tried some code.
var http = require('http');
var request = require('request');
http.createServer(function (req, res) {
request(header,callback);
function callback(error, response, body) {
if (req.url == '/feed') {
if (!error && response.statusCode == 200){}
var x = JSON.parse(body);
console.log(x);
}
}
}
I can able to print the JSON data in console. But I want to use that X value in outside of the callback function. I tried return, but no luck. Can you please help me