Vapor Documentation Beta

Structure Middlewares

public struct Middlewares

Configures an application's active Middleware. Middleware will be used in the order they are added.

Initializers

init()

public init()

Create a new, empty MiddlewareConfig.

Methods

use(_:​)

public mutating func use(_ middleware: Middleware)

Adds a pre-initialized Middleware instance.

var middlewareConfig = MiddlewareConfig.default()
middlewareConfig.use(fooMiddleware)
services.register(middlewareConfig)