0

I have created a project using the template in visual studio as below -

enter image description here

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.

enter image description here

JSON returned correctly for get method

enter image description here

I'm expecting to see the same JSON returned here

enter image description here

Question - how can I expose additional methods in the controller?

1 Answer 1

1

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)] 
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I knew it was going to be something simple!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.