Is there are easy way to remap services names and uris. For example, I want remap OrganizationUnit to be PreferenceUnit and all APIs associated with OrganizationUnit to be Preference, I am also not a big fan of long path to api. I would like /vX/subject/action As you can see I added versioning to api.
Please advise if you know, thanks a lot.
12 Answer(s)
-
0
you can set your Web API end point address Configuration.Modules.AbpWebApi().DynamicApiControllerBuilder.For<ITaskAppService>("taskSystemV2/task").Build();
Read the doc <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Dynamic-Web-API">https://aspnetboilerplate.com/Pages/Doc ... ic-Web-API</a>
check out the post as well #3189
-
0
@alper, thanks.
For net.core I found When an application service is converted to an MVC Controller, it's default route will look like this: /api/services/<module-name>/<service-name>/<method-name>. For example, if ProductAppService defines a Create method, it's URL will be /api/services/app/product/create (assuming that the module name is 'app').
So I can change /app/ to /v1/
- What about base path, like /api/services/, I want to change '' - empty string so just /api/
- What about custom mapping path, for example I want to remap all reference to OgranizationUnits controllers, simply to Groups, can I configure it?
Thanks for help.
-
0
hi,
You cannot change those :( When you see the code it's a literal string in private method. <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.Web.Api/WebApi/AbpWebApiModule.cs#L127">https://github.com/aspnetboilerplate/as ... le.cs#L127</a>
-
0
Looks like a simple configuration enhancement?
Can I override AbpWebApiModule and PostInitialize?
Thanks.
-
0
@vladsd, this can be an enhancement on ABP Framework, please create an issue here <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues">https://github.com/aspnetboilerplate/as ... ate/issues</a>.
-
0
done, thanks. see <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/3082">https://github.com/aspnetboilerplate/as ... ssues/3082</a>
-
0
hi thanks for the feedback. it'll be evaluated for the future releases.
-
0
@ismcagdas, I am surprised such an easy fix did not make into ABP v3.5.0
Hope you can find a time to include into next update.
Thank you.
-
0
<cite>vladsd: </cite> such an easy fix
ABP is an open-source framework and your contribution would be appreciated ;)
-
0
I looked into fixing and found that "api/services/" is hard coded all over the place. It is better for creators of the framework to fix such a simple oversight.
-
0
I disagree: aspnetboilerplate/aspnetboilerplate#3082
-
0
FYI,
For my own services I can map routes with one line: [Route("myroute/[controller]/[action]")] in front AppService definition
One gotcha - methods needs to be defined for each function.
What I am asking is a fix for the framework issue.