Skip to content
This repository has been archived by the owner on Oct 21, 2023. It is now read-only.

waigo/method-override

Repository files navigation

waigo-plugin-method-override

This waigo plugin provides:

methodOverride

This middleware allows you to override the HTTP method for an incoming request by either specifying the new HTTP method in the _method query parameter or the _method body parameter.

This allows you to, for example, call DELETE routes using a HTTP GET request.

Installation

$ npm install waigo-plugin-method-override

Example

You can enable this middleware per route:

// <app folder>/routes.js

module.exports = {
  ...

  'DELETE /item': ['methodOverride', 'item.delete'],

  ...
}

...or as common middleware for all routes:

// <app folder>/config/base.js

module.exports = function(config) {
  ...

  config.middleware.order = [
    'errorHandler',
    'staticResources',
    'methodOverride', 
    ...
  ];  
}

License

MIT - see LICENSE.md

About

HTTP request method overriding for Waigo

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published