|
4 | 4 | [](https://www.nuget.org/packages/ModEndpoints/) |
5 | 5 | [](https://github.com/modabas/ModEndpoints/blob/main/LICENSE.txt) |
6 | 6 |
|
7 | | -**ModEndpoints** provides a structured approach to organizing ASP.NET Core Minimal APIs using the REPR (Request - Endpoint - Response) pattern. It enhances the Minimal API paradigm by introducing reusable, testable, and consistent components for request validation, handling, and response mapping. |
| 7 | +**ModEndpoints** provides various base endpoint types to organize ASP.NET Core Minimal APIs in the REPR (Request - Endpoint - Response) pattern. It shapes Minimal APIs into components encapsulating configuration, automatic request validation, request handling, and, depending on endpoint type, response mapping. |
8 | 8 |
|
9 | 9 | --- |
10 | 10 |
|
11 | 11 | ## ✨ Features |
12 | 12 |
|
13 | 13 | - **REPR Pattern Implementation**: Organizes Minimal APIs into Request, Endpoint and Response components. |
14 | | -- **Seamless Integration**: Fully compatible with ASP.NET Core Minimal APIs, supporting configurations, parameter binding, authentication, OpenAPI tooling, filters, and more. |
15 | | -- **Auto-Discovery and Registration**: Automatically discovers and registers endpoints. |
| 14 | +- **Seamless Integration**: Fully compatible with ASP.NET Core Minimal APIs, supporting configurations, parameter binding, authentication, OpenAPI tooling, endpoint filters, route groups, etc. |
| 15 | +- **Auto-Discovery and Registration**: Automatically discovers and registers endpoints and route groups. |
16 | 16 | - **FluentValidation Support**: Built-in validation using FluentValidation; requests are automatically validated if a validator is registered. |
17 | | -- **Dependency Injection**: Supports constructor-based dependency injection in endpoint implementations. |
18 | | -- **Type-Safe Responses**: Enforces response model type safety in request handlers. |
| 17 | +- **Dependency Injection**: Supports constructor-based dependency injection in endpoint implementation types. |
| 18 | +- **Type-Safe Responses**: Provides response type safety in request handlers. |
19 | 19 |
|
20 | 20 | --- |
21 | 21 |
|
|
24 | 24 | ### MinimalEndpoint |
25 | 25 |
|
26 | 26 | - **Purpose**: Enables full flexibility and capability of Minimal APIs within a structured approach. |
27 | | -- **Usage**: Suitable for implementing any Minimal API endpoint, from simple to complex scenarios, while benefiting from clear separation of concerns and all features available to Minimal APIs. |
| 27 | +- **Usage**: Suitable for implementing any Minimal API in endpoint format, from simple to complex scenarios. |
28 | 28 | - **Package**: `ModEndpoints.Core` |
29 | 29 |
|
30 | 30 | ### WebResultEndpoint |
|
41 | 41 |
|
42 | 42 | ### ServiceEndpoint |
43 | 43 |
|
44 | | -- **Purpose**: Designed for simplifying remote service consumption with strongly typed request and response models. |
45 | | -- **Usage**: Works in conjunction with the `ModEndpoints.RemoteServices` package to abstract HTTP plumbing on the client side. |
| 44 | +- **Purpose**: Designed for simplifying remote service consumption only with knowledge of remote service base address and request model. |
| 45 | +- **Usage**: Works in conjunction with the `ModEndpoints.RemoteServices` package on client side to abstract HTTP plumbing while calling remote ServiceEndpoints. |
46 | 46 | - **Package**: `ModEndpoints` |
47 | 47 |
|
48 | 48 | > **Note**: For detailed information on each endpoint type, refer to the [Endpoint Types](./docs/EndpointTypes.md) documentation. |
|
53 | 53 |
|
54 | 54 | Each endpoint must implement two virtual methods: |
55 | 55 |
|
56 | | -1. **Configure**: Invoked during application startup to define the route and HTTP method for an endpoint. It begins with calling input parameter `builder`'s methods like `MapGet`, `MapPost`, etc., to specify the route pattern. The returned `RouteHandlerBuilder` from the Map[HttpVerb] method can then be used for further endpoint customization. |
| 56 | +1. **Configure**: Invoked during application startup to define the route and HTTP method along with any additional configuration endpoint requires. It begins with calling input parameter `builder`'s methods like `MapGet`, `MapPost`, etc., to specify the route pattern. The returned `RouteHandlerBuilder` from the Map[HttpVerb] method can then be used for further endpoint customization. |
57 | 57 |
|
58 | 58 | 2. **HandleAsync**: Contains the logic to handle incoming requests. Called after the request is validated (if applicable). |
59 | 59 |
|
60 | | -> **Note**: Dependencies resolved from constructor are not available during configuration. To access a service from dependency injection in the configuration phase, use the `ServiceProvider` property of the configuration context parameter in the `Configure` method. |
| 60 | +> **Note**: Dependencies resolved from constructor are not available during configuration. To access a service from dependency injection in the configuration phase, use the `ServiceProvider` property of the configuration context parameter provided to the `Configure` method. |
61 | 61 |
|
62 | 62 | > **Note**: `ServiceEndpoint` provides a default implementation for the `Configure` method, and only requires `HandleAsync` method implementation. |
63 | 63 |
|
|
0 commit comments