My issue arose when I was following a tutorial for angular. This is an angular front end with a Hapi server. The server alone works fine, I can use the browser or curl to make requests to these endpoints with no problem. However, when using HttpClient to make a request from the frontend, it does not work as expected. I am using a proxy to not deal with cors issues, but from what I can tell the same issue occurs either way.
Example from service file:
// return this.http.get<any>('/api/specific') // works
return this.http.get<any>('/api/general/specific') //doesn't work
}```
As seen in the comments, when making requests to /api/general or /api/specific or really /api/anything, it works no issues. However, if I try to nest another parameter in, such as in /api/general/specific, it does not work. It ends up returning my default app index.html page, which causes an error as JSON is expected.
What could be causing this issue? Why does it not work as is? What can be done to make it work without doing something completely different? Is this just how it works?
The important code snippets can be found at this gist: https://gist.github.com/cisco95/bfe877f44610fcf641f738afbb414924
The full code is located here:
https://github.com/cisco95/angular-testapp