Reputation: 355
I have created a project using the template in visual studio as below -
This has created the 'WeatherForecast' controller with a simple get method. I would like to add additional methods to this controller as a test but when accessing this methods, the Angular homepage is returned. As a test I have navigated to the urls in a browser and correctly see the json returned for /get but the Angular homepage is returned for /MyTeam. I imagine there is a simple configuration I've missed somewhere but after hours of searching I'm stuck.
JSON returned correctly for get method
I'm expecting to see the same JSON returned here
Question - how can I expose additional methods in the controller?
Upvotes: 0
Views: 52
Reputation: 26
It looks like both the methods have the same default route
[Route("")]
Try changing the route for the other get methods. You can either decorate the method using:
[HttpGet("team")]
or
[HttpGet]
[Route("myteam)]
Upvotes: 1