Class: StaticFileMiddleware
Class: StaticFileMiddleware
Kernel Middleware for serving static files from a directory. If a static file is found, it serves the file; otherwise, the request is passed to the next middleware.
Constructors
Constructor
new StaticFileMiddleware(container): StaticFileMiddleware;
Create a new StaticFileMiddleware instance.
Parameters
container
The service container to inject dependencies.
blueprint
IBlueprint
logger
ILogger
Returns
StaticFileMiddleware
Methods
handle()
handle(event, next): Promise<OutgoingHttpResponse>;
Handle incoming HTTP events and serve static files if applicable.
Parameters
event
The incoming HTTP event.
next
NextMiddleware
<IncomingHttpEvent
, OutgoingHttpResponse
>
The next middleware in the pipeline.
Returns
Promise
<OutgoingHttpResponse
>
The outgoing HTTP response.
Throws
If access to the file is forbidden.