Issue
I'm building a new Angular app with an ASP.NET Core backend. The requests (via HttpClient.Get
in the Angular app) work fine when I'm using the default WeatherForecastController
, nevertheless when I create a new BaseController
, its route is unreachable.
I found that I could access it via another port (7188 instead of 4200) but it doesn't seem logical to do that, would you have any idea how to fix that?
In my Angular app, I should be able to call my API for a new controller like it works for the default controller :
http.get<User[]>('/weatherforecast') => It works
http.get<User[]>('/demo') => It doesn't works
(Of course the structure of the controller is exactly the same as the default controller)
Solution
Please check if your file proxy.conf.js contains the context
property route to this controller. If not add it the same as it is done for the weatherforecast one. This should solve the problem.
Answered By - Krystian Sitek
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.