thangchung / clean-architecture-dotnet

🕸 Yet Another .NET Clean Architecture, but for Microservices project. It uses Minimal Clean Architecture with DDD-lite, CQRS-lite, and just enough Cloud-native patterns apply on the simple eCommerce sample and run on Tye with Dapr extension 🍻
MIT License
1.23k stars 265 forks source link

Refactor to the truly minimal routing on each services #12

Closed thangchung closed 3 years ago

thangchung commented 3 years ago
  1. To make it truly minimal, we need to refactor it to Map router on each service (that's mean we remove Swagger on each host, but I think after 6.0.100-preview.6.21308.9 SDK released, then we can bring back Swagger, see at https://github.com/halter73/swagger), and map it like https://github.com/halter73/MinimalWeather/blob/main/dotnet/MinimalWeather/Program.cs and https://github.com/dodyg/practical-aspnetcore/blob/net5.0/projects/net6/web-application-8/src/Program.cs, and https://github.com/425show/MinimalWeather/blob/main/Program.cs

  2. Refactor to 3 projects (one service - core + app and API only to make it is more simply), refactor App layer only contain interfaces + use cases + model only (and depends on Infrastructure layer)

    • CoreApp: Core + App layers
    • Infrastructure layer
    • API layer
  3. Then we write the aggregator like https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/src/ApiGateways/Web.Bff.Shopping/aggregator, the reason is we need one centralize endpoints with swagger.json file, then we will use some kind of Swagger Client Generator like https://github.com/RicoSuter/NSwag/wiki/NSwagStudio to generate the HTTP client with all APIs we have. Then we can use it inside the Blazor app (we gonna refactor to remove the current web which is implemented using nextjs. But need to investigate more