Base solution for your next web application
Open Closed

WebApi Module to generate dynamic js proxy for custom WebApi #317


User avatar
0
paul lee created

I have successfully added a custom WebApi controller in the WebApiModule, but how can I get ABP to generate the Dynamic JavaScript Proxy for these custom WebApi controllers?

If I can not, does that means I will have to hardcode the URL in the AngularJs side to consume these controllers?


3 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Yes, automatic javascript proxies usable just for dynamic web api layer currently. This feature is in the road map: <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/94">https://github.com/aspnetboilerplate/as ... /issues/94</a>

  • User Avatar
    0
    paul lee created

    Hi Halil,

    I would like to take a stab at the problem but I need some information on how the JavaScript proxies are being generated by the framework at the moment. However, I could not find the info from ABP documentations. Will you be kind enough to explain briefly about this process?

    Thank you!

  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    It's not in documents since it's internal implementation of ABP. But since ABP is open source, you can get codes and see it. This class (<a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/src/Abp.Web.Api/WebApi/Controllers/Dynamic/Scripting/ServiceProxiesController.cs">https://github.com/aspnetboilerplate/as ... troller.cs</a>) can be a starting point to follow. For example <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/src/Abp.Web.Api/WebApi/Controllers/Dynamic/Scripting/Angular/AngularActionScriptWriter.cs">https://github.com/aspnetboilerplate/as ... tWriter.cs</a> creates a method for angularjs.

    Briefly, it dynamically creates javascript. You can do it for a regular web api controller by reflection.