Consuming HTTP APIs
You can use the standard HttpClient
to manually set up and perform an HTTP request to the server. However, ABP provides C# client proxies to call HTTP API endpoints easily. You can directly consume your application services from the Blazor UI and let ABP Framework handle the HTTP API calls for you.
Let's assume that we have an application service interface, as shown in the following example:
public interface ITestAppService : IApplicationService { Task<int> GetDataAsync(); }
Application service interfaces are defined in the Application.Contracts
project (the DemoApp.Application.Contracts
project for the example solution I've created). The Blazor application has a reference to that project. This way, we can use the ITestAppService
interface on the client side.
Application services are implemented in the Application
project (the DemoApp.Application
project for the example solution I've created). We can simply...