import { Router } from "https://deno.land/x/oak@v17.1.3/router.ts";
Middleware that handles requests for HTTP methods registered with the router. If none of the routes handle a method, then "not allowed" logic will be used. If a method is supported by some routes, but not the particular matched router, then "not implemented" will be returned.
The middleware will also automatically handle the OPTIONS
method,
responding with a 200 OK
when the Allowed
header sent to the allowed
methods for a given route.
By default, a "not allowed" request will respond with a 405 Not Allowed
and a "not implemented" will respond with a 501 Not Implemented
. Setting
the option .throw
to true
will cause the middleware to throw an
HTTPError
instead of setting the response status. The error can be
overridden by providing a .notImplemented
or .notAllowed
method in the
options, of which the value will be returned will be thrown instead of the
HTTP error.