2
votes

I have a small-to-medium sized application in ASP.NET MVC 4 (we call it Portal) and we plan to migrate to something more lightweight and dynamic (like a single page application).

Since our mobile app is in Ionic 1 and we are migrating it to Ionic 2, I want to migrate our Portal to Angular2 as well.

My goal is to find the best approach focusing performance and scalability.

As far as I understand, basically I have two options:

  1. Create an ASP.NET Core MVC application and add Angular2 libraries (http://www.centare.com/tutorial-angular2-mvc-6-asp-net-5/)

  2. Create an ASP.NET Core application, serve it as a WEB API and create a Angular2 application outside the solution (even using another IDE, like Visual Studio Code) and call that rest web API.

Am I missing the big picture or is it right? As more experienced guys, what do you advice me?

Thank you in advance

1
This blog post is missing Index.html in wwwroot which, I guess, should be the Home page of the Angular 2 app and Add more subsequent views also in wwwroot which gets data from API(s). - Janshair Khan
_Layout.cshtml does the job. Yeah. But I don't know if I should create another website (a WEB API) or put my controllers in the same web site, mixing ASP.NET MVC and Angular2. - Hugo Ramos

1 Answers

0
votes

I think WebApi and SPA should be completely different projects. When you setup your frontend webserver like nginx you can configure it to serve all /api requests from ASP.NET web api and handle other request through SPA. So it makes clean separation of different layers of you app and allows you to easily add other backend services and frontend SPA apps (if needed) in the future.