Typealiases

The following typealiases are available globally.

  • The definition of the closure type that is used by the Router class when routing HTTP requests to closure.

    Declaration

    Swift

    public typealias RouterHandler = (RouterRequest, RouterResponse, @escaping () -> Void) throws -> Void

    Parameters

    request

    The RouterRequest object that is used to work with the incoming request.

    response

    The RouterResponse object used to send responses to the HTTP request.

    next

    The closure to invoke to cause the router to inspect the path in the list of paths.

  • Type alias for Before flush (i.e. before headers and body are written) lifecycle handler.

    Declaration

    Swift

    public typealias LifecycleHandler = () -> Void
  • Type alias for written data filter, i.e. pre-write lifecycle handler.

    Declaration

    Swift

    public typealias WrittenDataFilter = (Data) -> Data