ardalis / CleanArchitecture

Clean Architecture Solution Template: A starting point for Clean Architecture with ASP.NET Core
MIT License
16.25k stars 2.8k forks source link

Separating REST API project from UI (MVC project) #105

Closed ghanavat closed 4 years ago

ghanavat commented 4 years ago

I have been studying this CleanArchitecture solution to learn/understand how a RESTful API project sits and fits in DDD architecture.

Say we want to have a separate REST API project from UI (MVC). How are we meant to consume it and feed the MVC UI? Without API, we would inject IRepository into the MVC controller and we take it from there.

ardalis commented 4 years ago

You can certainly separate out the APIs from the MVC or Razor Pages implementation. I expect most users of this template will probably only use one of these 3 technologies and will remove the ones they don't need. If you need two of them but want them in separate projects just copy the web project as needed.