import { withFormBody } from "https://deno.land/x/reno@v2.0.105/reno/mod.ts";
A higher-order function that takes a route handler function and
returns another route handler that parses form data bodies before
invoking the inner handler. The data is parsed internally by
creating a URLSearchParams
instance, which is then passed to
the inner handler via the body
prop of the first argument:
const getNameLength = withFormBody(({ parsedBody }) =>
new Response(`?name is ${(parsedBody.get('name') || '0').length} bytes`)
);
Parameters
handler: RouteHandler<FormRequest>