I am trying to create an API controller in my ASP.NET core 5 Razor Pages web application.
I have created the Api Controller inside a folder named Api
in Visual studio.
Then when I try to run the following url to test that the api controller works, I get a 404 not found:
https://localhost:345345/api/saveimage
What am I missing?
Api Controller (SaveImageController.cs):
[Route("api/[controller]")]
[ApiController]
public class saveImageController : ControllerBase
{
[HttpGet]
public IEnumerable<string> Get()
{
return new string[] { "test", "test2" };
}
}