0

Hello Stackers,

I have an Asp.net Mvc and i wanna migrate the index page from it to an Web Api i wanna know if there is any pattern or approach to follow for making it more easy. i google it but i didn't found a useful answer.

Any answer will be appreciate it.

Thanks

Abdessamad Jadid
  • 381
  • 1
  • 4
  • 16
  • 1
    The spec for Web API and MVC are very similar so I would start by simply changing your controllers to inherit from ApiController rather than Controller i.e. MyController : ApiController. Check out [this doc](https://learn.microsoft.com/en-us/aspnet/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api#adding-a-controller) from Microsoft. – Glynn Hurrell Sep 06 '20 at 02:21

1 Answers1

1

I am not sure if there is a pattern, but next some steps that could help.

  • Group all your services that returns, saves, delete or do some work in the backend. On your backend you could create a new layer (New project or new namespace) to call the existing ones and export those services as Web API endpoints.
  • On your frontend check how are you going to consume your Web API services. I mean if you are going to call it directly with javascript or maybe using some library or framework.

Those are going to be the first steps.

Kev
  • 561
  • 5
  • 8