Hi,
We are using the DotNetCore MVC/jQuery solution..
We find that having all our API calls only be accessible via the path domain.com/api/services/app/Component/Method very inconvenient for our customers. We also realize that as most the API calls are dynamically generated from our AppServices, we are kind of locked in to this.
Since the actual API set we want to expose is fairly small, what we would like to do as a work around, so our customers can simply access the api from domain.com/api/Component/Method is create a small WebApi proxy layer that literally acts as a 100% passthru to the subset of AppService Api calls. My question is 3 fold:
what project do we implement this so that these WebAPI calls will be accessible within both the MVc and the Host proect
How do we set a custom route for these calls? I can't seem to get custom routes working in any Abp or AspNetZero projects
How do we ensure these calls are included in our Swagger UI?
Also, if there are already some example of custom non-AppService API's being exposed like this, I could probably figure this out, happy to be pointed to the right area if I'm just missing it...
thanks! jasen
6 Answer(s)
-
0
Related issue with workaround: aspnetboilerplate/aspnetboilerplate#3082
- what project do we implement this so that these WebAPI calls will be accessible within both the MVc and the Host proect
Web.Core project.
- How do we set a custom route for these calls? I can't seem to get custom routes working in any Abp or AspNetZero projects
[Route("")] attribute.
- How do we ensure these calls are included in our Swagger UI?
[RemoteService] attribute.
-
0
Yes, I had seen that solution you suggested but didn't want to break the dynamic js api that is created so opted for a thin proxy layer. I will try this today, thank you.
-
0
@statuscast any news ?
-
0
Closing due to inactivty.
-
0
I mentioned in e-mail I couldn't respond here until my password was reset, sorry it was still considered abandoned.
The Route decorator worked fine as expected. We ended up using Swashbuckle and API versioning to give us a limited swagger file that we could publish as our API docs. So we have a "full" and "public" API now. The full is all inclusive and still includes all the ABP/AZ stuff. The "public" one is only showing API's that are decorated with GroupName="" We still unfortunately have to proxy out all our public API's that are dynamically generated, but it's not a huge deal. So, our proxy API looks something like this now:
[ApiExplorerSettings(GroupName = "public")] [Route("/api/Components")] public class ComponentsController : StatusCastControllerBase { private readonly IComponentsAppService _componentsAppService; public ComponentsController(IComponentsAppService componentAppService) { _componentsAppService = componentAppService; } [HttpGet] [RemoteService(IsMetadataEnabled = true)] [Route("GetAll")] public async Task<PagedResultDto<Components.Dtos.GetComponentForView>> GetAll(Components.Dtos.GetAllComponentsInput input) { return await _componentsAppService.GetAll(input); } }
-
0
@statuscast thanks a lot for sharing this with us. Can we close the topic ?