Class WellKnownRoutesMiddleware
- Namespace
- Cratis.Arc.Http
- Assembly
- Cratis.Arc.Core.dll
Middleware for handling well-known routes (e.g., commands, queries).
public class WellKnownRoutesMiddleware : IHttpRequestMiddleware
- Inheritance
-
WellKnownRoutesMiddleware
- Implements
- Inherited Members
- Extension Methods
Remarks
Initializes a new instance of the WellKnownRoutesMiddleware class.
Constructors
WellKnownRoutesMiddleware(IServiceProvider, ILogger<WellKnownRoutesMiddleware>)
Middleware for handling well-known routes (e.g., commands, queries).
public WellKnownRoutesMiddleware(IServiceProvider serviceProvider, ILogger<WellKnownRoutesMiddleware> logger)
Parameters
serviceProviderIServiceProviderThe service provider for request scoping.
loggerILogger<WellKnownRoutesMiddleware>The logger for the middleware.
Remarks
Initializes a new instance of the WellKnownRoutesMiddleware class.
Methods
InvokeAsync(HttpListenerContext, HttpRequestDelegate)
Process an HTTP request.
public Task<bool> InvokeAsync(HttpListenerContext context, HttpRequestDelegate next)
Parameters
contextHttpListenerContextThe HTTP listener context.
nextHttpRequestDelegateThe next middleware in the pipeline.
Returns
- Task<bool>
A task that represents the asynchronous operation, returning true if the request was handled, false otherwise.
RegisterRoute(string, string, Func<IHttpRequestContext, Task>, EndpointMetadata?)
Registers a route with the middleware.
public void RegisterRoute(string method, string pattern, Func<IHttpRequestContext, Task> handler, EndpointMetadata? metadata = null)
Parameters
methodstringThe HTTP method.
patternstringThe route pattern.
handlerFunc<IHttpRequestContext, Task>The handler for the request.
metadataEndpointMetadataOptional metadata for the endpoint.