This project demonstrates how to implement a resilient API using the Polly
library. Below is an overview of the project structure.
- Clone the repository.
- Open the solution in Visual Studio or Rider
- Run the
ResilientApi
project. - Run the
ResilientApiGateway
project. - Navigate to the Swagger UI for the
ResilientApiGateway
project athttp://localhost:5224/swagger/index.html
orhttps://localhost:7217/swagger/index.html
- Navigate to the Swagger UI for the
ResilientApi
project athttp://localhost:5282/swagger/index.html
orhttps://localhost:7266/swagger/index.html
- Use the
ResilientApiGateway
Swagger UI to perform READ operations on theCar
entity.- Note that you can trigger a manual error by using the
GET: api/cars/{id}/with-random-error
endpoint when you enter-1
otherwise it will randomly cause error.
- Note that you can trigger a manual error by using the
- Use the
ResilientApi
Swagger UI to perform CRUD operations on theOwner
andCar
entities.
The project ResilientApiGateway
is the main project that contains the client implementation of the resilient API.
The project is a ASP.NET Core Web Api (8.0 Framework)
that can be run locally. ResilientApiGateway
communicates with the ResilientApi
project to perform READ operations on the Car
entity to demonstrate the resilience of the system.
The project ResilientApi
is the main project that contains the REST API implementation.
The project is a ASP.NET Core Web Api (8.0 Framework)
that can be run locally.The business logic of ResilientApi
is contained within the ResilientApi.Data
class library project.
There is one specific endpoint that is used by the ResilientApiGateway
project to demonstrate the resilience of the system.
It is the GET: api/cars/{id}/-with-random-error
endpoint for the Car
entity.