Vapor Documentation Beta

Class File​Middleware

public final class FileMiddleware: Middleware

Serves static files from a public directory.

FileMiddleware will default to DirectoryConfig's working directory with "/Public" appended.

%3 FileMiddleware FileMiddleware Middleware Middleware FileMiddleware->Middleware

Conforms To

Middleware

Middleware is placed between the server and your router. It is capable of mutating both incoming requests and outgoing responses. Middleware can choose to pass requests on to the next Middleware in a chain, or they can short circuit and return a custom Response if desired.

Initializers

init(public​Directory:​)

public init(publicDirectory: String)

Creates a new FileMiddleware.

Methods

respond(to:​chaining​To:​)

public func respond(to request: Request, chainingTo next: Responder) -> EventLoopFuture<Response>

See Middleware.