I want to make an URL request, its outcome would be a JSON
after I have tried it in the browser.
I want to put the entire JSON response in a var or const for further processing afterward.
What i have tried so far:
app.use(express.bodyParser());
app.post(MY_URL, function(request, response){
console.log(request.body);
console.log(request.body;
});
Then :
app.use(bodyParser.urlencoded({
extended: true
}));
app.post(MY_URL, function (req, res) {
console.log(req.body)
});
Both of which haven't worked out and being a beginner in node.js
isn't helping.
Edit: In order to clarify my question:
my_url = https://only_an_example
That URL typed in the browser will give a Json in that page like the following:
{
"query": "testing",
"topScoringIntent": {
"intent": "Calendar.Add",
"score": 0.987683
},
"intents": [
{
"intent": "Calendar.Add",
"score": 0.987683
},
{
"intent": "None",
"score": 0.0250480156
}}
What i want is to get that Json response and print it using node.js.