expressjs support for method delete and put without the methodoverride expressjs support for method delete and put without the methodoverride express express

expressjs support for method delete and put without the methodoverride


You just need to set the form to post, then create a hidden field like

<input type="hidden" name="_method" value="delete"/>

And set the configuration, according to the express version you are using. Then the form method will be overridden by the value of that hidden field.

The latest version of will require you to install the method-override package, then configure your app like this:

var methodOverride = require('method-override')app.use(methodOverride('_method'));

Old versions might use:

app.use(bodyParser.json());app.use(bodyParser.urlencoded());app.use(express.methodOverride());

An even older usage was:

app.use(express.bodyParser());app.use(express.methodOverride());


actually express.bodyParser() is deprecated in versions 3.4 of Express and 2.9 of Connect.There is security issues on the use of express.bodyParser() explained here