Class FallbackMiddleware
- Namespace
- Cratis.Arc.Http
- Assembly
- Cratis.Arc.Core.dll
Middleware for serving a fallback file when no route matches (typically for SPAs).
public class FallbackMiddleware : IHttpRequestMiddleware
- Inheritance
-
FallbackMiddleware
- Implements
- Inherited Members
- Extension Methods
Remarks
Initializes a new instance of the FallbackMiddleware class.
Constructors
FallbackMiddleware(ILogger<FallbackMiddleware>)
Middleware for serving a fallback file when no route matches (typically for SPAs).
public FallbackMiddleware(ILogger<FallbackMiddleware> logger)
Parameters
loggerILogger<FallbackMiddleware>The logger for the middleware.
Remarks
Initializes a new instance of the FallbackMiddleware class.
Methods
ConfigureFallback(string, string)
Configures the fallback file to serve.
public void ConfigureFallback(string fallbackFilePath, string fileSystemBasePath)
Parameters
fallbackFilePathstringThe path to the fallback file, relative to the file system base path.
fileSystemBasePathstringThe base file system path.
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.