init(closure:)

Create a new BasicResponder.

AsyncBasicResponder.swift:17
init(closure: @escaping (Request) async throws -> Response)

Parameters

closure

Responder closure.

let notFound: Responder = BasicResponder { req in
    let res = req.response(http: .init(status: .notFound))
    return req.eventLoop.newSucceededFuture(result: res)
}