respondWith function

Handler respondWith(
  1. Responder responder
)

Creates a Handler that uses the given Responder function to generate a response.

This adapts a simpler Request -> Response function (Responder) into the standard Handler format. The returned Handler takes a Request, passes it to the responder, and returns the resulting Response.

Example:

final handler = respondWith(
  (final request) => Response.ok(
    body: Body.fromString('Hello, Relic!'),
  ),
);

Implementation

Handler respondWith(Responder responder) => responder;