I've been using ASP.Net MVC (with Razor syntax) successfully for over a year now and wanting to move to Web API.
With MVC I'd usually set my n-tier architecture up as follows (simplified for ease of explanation):
- Data (Class Library)
- Repository (Class Library)
- Services (Class Library)
- Presentation (MVC)
What I am starting to dislike about this is that there seems to be a lot going on in the Presenation layer; you've got models, razor views, controllers plus any added niceties such as javascript / AngularJS & CSS.
How would you recommend I set up my tiers when using Web API instead of MVC? Is it the same as above but with an added layer? Something like this:
- Data (Class Library)
- Repository (Class Library)
- Services (Class Library)
- Web API
- Presentation (HTML + javascript + CSS)
Or are all the HTML pages to be put in the same project as the Web API? This seems odd to me as I feel like you need to keep your API separate from all other concerns such as the User Interface.
Any insight will be gratefully received.