Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/oak_nest/mod.ts>OriginRouter#allowedMethods

Refer to nestjs to realize some common functions for Deno
Go to Latest
method OriginRouter.prototype.allowedMethods
import { OriginRouter } from "https://deno.land/x/oak_nest@v2.0.0/mod.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.

Parameters

optional
options: RouterAllowedMethodsOptions = [UNSUPPORTED]