RA.Utilities.Api
RA.Utilities.Api provides a collection of essential utilities for building robust and consistent ASP.NET Core APIs. This package includes endpoint registration helpers, standardized response models, and exception handling middleware to streamline development and promote best practices.
It acts as the glue between the RA.Utilities.Core
libraries and your web application, providing concrete implementations for ASP.NET Core.
🎯 Purpose
This package is designed to solve two common challenges in API development:
- Consistent Error Handling: It provides a middleware that automatically catches custom exceptions from
RA.Utilities.Core.Exceptions(likeNotFoundException,ConflictException) and transforms them into standardized JSON responses using models fromRA.Utilities.Api.Results. - Clean Endpoint Organization: It offers a simple pattern for organizing API endpoints into separate files, keeping your
Program.csclean and your routes maintainable as the application grows.
By using this package, you can significantly reduce boilerplate code and enforce consistency across all your API endpoints.
🛠️ Installation
You can install the package via the .NET CLI:
dotnet add package RA.Utilities.Api
Or through the NuGet Package Manager console:
Install-Package RA.Utilities.Api
Or through the NuGet Package Manager in Visual Studio.
🔗 Dependencies
📄️ GlobalExceptionHandler
The GlobalExceptionHandler is a crucial component in your API's architecture.
🗃️ Mappers
3 items
📄️ EndpointExtensions
The EndpointExtensions class is a key component of your RA.Utilities.Api package.