I have a controller with Route attribute as well as every Action with it`s own Route like:
[Route("api/version/v1")]
public class MyController : ControllerBase
{
[Route("receipts/verifyReceipt")]
public IActionResult VerifyReceipt(...){....}
...... several actions with diffrent Routes
}
My aim is to have api route : 'api/version/v1/receipts/verifyReceipt'
How can I set prefix [Route("api/version/v1")]
from config.json
I`ve tried to set it up from Startupt.cs
app.UseMvc(routes =>
{
routes.MapRoute( "default", apiCommon.Value);
});
where 'apiCommon.Value' is my prefix 'api/version/v1' While adding route attribute to MyController:
[Route("", Name = "default")]
But that seems to have no effect. And api route looks like this: '/receipts/verifyReceipt'
Any Ideas what I`am doing wrong?