RouterMiddleware
public protocol RouterMiddleware
Defines the protocol which all Kitura compliant middleware must implement.
Middleware are class or struct based request handlers. They are often generic in nature and not tied to a specific request.
-
Handle an incoming HTTP request.
Throws
Any
ErrorType. If an error is thrown, processing of the request is stopped, the error handlers, if any are defined, will be invoked, and the user will get a response with a status code of 500.Declaration
Swift
func handle(request: RouterRequest, response: RouterResponse, next: @escaping () -> Void) throwsParameters
requestThe
RouterRequestobject used to work with the incoming HTTP request.responseThe
RouterResponseobject used to respond to the HTTP request.nextThe closure called to invoke the next handler or middleware associated with the request.
View on GitHub
RouterMiddleware Protocol Reference