Is there a way to pass specific variables to my proxy in order to make API calls with customized parameters, similar to the scenario outlined below?
This is how my proxy configuration appears:
{
"/darksky/*": {
"target": "https://api.darksky.net/forecast/APIKEY/",
"secure": false,
"logLevel": "debug",
"changeOrigin": true
}
}
In my service, I utilize this proxy as follows:
return this.http.get(`/darksky/${x},${y},${date}?exclude=hourly,daily,flags&units=auto`);
While attempting to pass variables x, y, and date along with fixed settings to the URL, the console displays:
[HPM] GET /darksky/53.1219648,18.0002529,2019-12-04T12:00:00?exclude=hourly,daily,flags&units=auto -> https://api.darksky.net/forecast/APIKEY/
The API reports that the request was incorrectly formatted due to the absence of these additional variables. How can I correctly pass data to the proxy for the redirect to appear like this:
https://api.darksky.net/forecast/APIKz/53.1219648,18.0002529,2019-12-04T12:00:00?exclude=hourly,daily,flags&units=auto
UPDATE: Angular JSON Configuration
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
// Remaining contents replaced for brevity
}