Base solution for your next web application
Open Closed

Using boilerplate with a REST api #2623


User avatar
0
donpedrodelamuerte created

Hello! I'm using Abp template with module zero to make a basic web app. So far Abp features are all I need.

But I also have to use a REST api. As far as I understand, the .web project is the client application layer and it's mostly using MVC I think.

After reading the doc, I found the Dynamic-Web-API. Is that what I need to use Abp with a REST api ? It sounds like all I have to do create an interface ITaskAppService : IApplicationService and set

Configuration.Modules.AbpWebApi().DynamicApiControllerBuilder.For<ITaskAppService>("tasksystem/task").Build();

Is that it or is there anything else I need to know?
What will prevent the user to use the basic MVC controller already implemented in the .web projects?

thanks!


5 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    If you are using ASP.NET MVC 5.x in your project, you can host your application services as restful webapi methods. It is configured here for all app services in the project <a class="postlink" href="https://github.com/aspnetboilerplate/module-zero-template/blob/master/src/AbpCompanyName.AbpProjectName.WebApi/Api/AbpProjectNameWebApiModule.cs">https://github.com/aspnetboilerplate/mo ... iModule.cs</a>.

    Did you started with module-zero template ? You can download it's latest version and try this by yourself.

  • User Avatar
    0
    donpedrodelamuerte created

    Hi,

    sorry for the late reply, I don't work often on that project.

    I took the asp.net Core 1.x template with module zero actually, but I guess it's the same as the mvc 5.x, is it ?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You got it correct. But I Couldn't understand this part very well

    What will prevent the user to use the basic MVC controller already implemented in the .web projects?
    

    Can you exlain it a bit more detailed ?

    Thanks.

  • User Avatar
    0
    donpedrodelamuerte created

    Maybe I didn't understand how RESTful api work. I'm a student and still a newbie in web application. So it's probably not the place to discuss this. But I thought all request needed to be an http request GET, PUT, POST etc...

    If I write directly the url let say localhost:1234/controller/action

    Am I not bypassing the web api?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    But I thought all request needed to be an http request GET, PUT, POST etc...
    

    This is correct.

    If you call any url from browser directly and if it does not require authentication you will get the response.

    But at this point, I'm not sure if I did answer your question or not.