Allowed Methods Restricter


This middleware works by default for * HTTP Methods and will throw an 405 Method Not Allowed error when the there will be a request sent with an HTTP Method that is not allowed.

It will help you solve this security problem.

export type HTTPMethod = 'GET' | 'POST' | 'DELETE' | 'PATCH' | 'POST' | string;export type AllowedHTTPMethods = HTTPMethod[] | '*'

To write a custom logic for this middleware follow this pattern:

// nuxt.config.js{  modules: [    "nuxt-security",  ],  security: {    allowedMethodsRestricter: {      value: ['POST'],      route: '/my-custom-route'    }  }}