My Startup.cs class has the following:
app.UseMvc(routes =>
{
routes.MapRoute("default", "api/{controller}/{action=Get}");
});
All of my MVC controllers have a Get on the method, and some of them have a Post. Something like that:
public class ExampleController : Controller
{
[HttpGet]
public MyType Get()
{
return GetMyTypeFromSomewhere();
}
[HttpPost("api/[controller]")]
public void Post([FromBody]MyType updated)
{
}
}
Currently, I need to have the ("api/[controller]")
Mail method so that messages can reach it.
I want to be able to remove this and redirect POST requests to the default Post server methods. The problem is that if I do this in the current state, the POST HTTP requests end up sending to /api/Example/Get
.
MapGet
MapPost
, , RequestDelegate. .
?
, , GET POST , api/controller/action
, {action}
, -. , Get Post , =Get
MapRoute