StaticFileServer
public class StaticFileServer: RouterMiddleware
A router middleware that serves static files from a given path.
-
Cache configuration options for StaticFileServer.
See moreDeclaration
Swift
public struct CacheOptions
-
Configuration options for StaticFileServer.
See moreDeclaration
Swift
public struct Options
-
Undocumented
Declaration
Swift
public class StaticFileServer: RouterMiddleware
-
Initializes a
StaticFileServer
instance.Declaration
Swift
public init(path: String = "./public", options: Options = Options(), customResponseHeadersSetter: ResponseHeadersSetter? = nil)
Parameters
path
a root directory for file serving.
options
configuration options for StaticFileServer.
customResponseHeadersSetter
an object of a class that implements
ResponseHeadersSetter
protocol providing a custom method to set the headers of the response. -
Handle the request - serve static file.
Declaration
Swift
public func handle(request: RouterRequest, response: RouterResponse, next: @escaping () -> Void)
Parameters
request
the router request.
response
the router response.
next
the closure for the next execution block.