docs/docsets/Kitura.docset/Contents/Resources/Documents/Classes/RouterMiddlewareGenerator.html
public class RouterMiddlewareGenerator : RouterMiddleware
Create an on the fly RouterMiddleware from a RouterHandler closure.
`
init(handler:)
`
Initialize a RouterMiddlewareGenerator instance
Swift
public init(handler: @escaping RouterHandler)
| handler |
The closure that is of the type RouterHandler to be called to handle requests
|
`
handle(request:response:next:)
`
Implementation of RouterMiddleware protocol. A simple wrapper around the closure that will handle the request.
Swift
public func handle(request: RouterRequest, response: RouterResponse, next: @escaping () -> Void) throws
| request |
The RouterRequest object used to work with the incoming HTTP request.
|
| response |
The RouterResponse object used to respond to the HTTP request.
|
| next |
The closure called to invoke the next handler or middleware associated with the request.
|