• Exams of ASP.NET - Managing the shopping cart - Revisiting the CQRS pattern - The message broker - What is a Modular Monolith?

    Fetching the shopping cart – Introduction to Microservices Architecture

    The Baskets service only stores the customerId, productId, and quantity properties. However, a shopping cart page displays the product name and price, but the Products service manages those two properties.To overcome this problem, the endpoint acts as an aggregation gateway. It queries the shopping cart and loads all the products from the Products service before returning an aggregated result, removing the burden of managing this complexity from the client/UI.Here’s the code main feature code: app.MapGet(    “api/cart”,    async (IWebClient client, ICurrentCustomerService currentCustomer, CancellationToken cancellationToken) =>    {        var basket = await client.Baskets.FetchCustomerBasketAsync(            new(currentCustomer.Id),            cancellationToken        );        var result = new ConcurrentBag<BasketProduct>();        await Parallel.ForEachAsync(basket,…