I need to make a http call within my node server .The optional parameter is:
- 'name='
This means that url (relative path) should look like:
/v1/clans?name=**exampleValue**
So far the options for my http request looks like:
app.get('/v1/:clans?=:name', (req, res) => {
console.log(req.path)
const options = {
host: 'api.clashofclans.com',
path: req.path,
method: 'GET',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer *token*'
}
};
const x = https.get(options, (request) => {...});
But that doesnt work out. Does someone know how to include the optional parameters in my path property?