mirror of https://github.com/vapor/docs.git
528 B
528 B
Responder
Responders are a type capable of responding to a Request.
Responders are always async by returning a Future<Response> by either transforming/mapping an existing future or creating it's own promise.
Implementing a static Responder
struct StaticResponder: Responder {
let response: Response
init(response: Response) {
self.response = response
}
func respond(to req: Request) throws -> Future<Response> {
return response
}
}