I have an endpoint https://www..com
When I make a curl call, I have the endpoint as https://www..com?param1=true
I want to do a similar call from Nodejs, I am not sure if param1 should be passed in headers, concatenated to the endpoint or passed in options. What is the right way to do so?
My Node JS looks like this to make calls to my Node Server amd my file looks as follows,
app.post('/thisway', function(req, res){
var ENDPOINT = req.body.endPoint
//(this gets me till https://<url> part of the endpoint string)
var urlToHit = ENDPOINT.concat("?param1=true")
var headers = {
'Authorization': xxxxx,
'Accept': '*/*',
'X-Spark-Service-Instance': xxxxx
}
var options= {
url: urlToHit,
headers: headers,
json: {xxxxxx}
}
request(options, callback);
}