
According to the document
If the method has an 'id' parameter then it adds '/{id}' ro the route.
I wonder if I can change it to "code" then it adds '/{code}'.
yes,you can, just do it
change all id to code
If you want to keep the Auto API Controller feature working and customize an API's route, the simple way is adding [Route("your custom route")] attribute to the method of the application service class.
If you want to follow the best practice:
[RemoteService(false)] attribute to the method of the application service class.For more information: https://docs.abp.io/en/abp/latest/API/Auto-API-Controllers
Another way for you :)
private void ConfigureConventionalControllers()
{
Configure<AbpAspNetCoreMvcOptions>(options =>
{
options.ConventionalControllers.Create(typeof(MyProjectApplicationModule).Assembly, opt =>
{
opt.UrlActionNameNormalizer = context =>
{
if (context.ControllerName == "AdminUser" && context.Action.ActionMethod.Name == "GetAdminUserAndStationAsync")
{
return "{code}/adminUserAndStationAsync";
}
return null;
};
});
}
}
Most helpful comment
Another way for you :)