What's the role of the method-override middleware in Express 4?

express, node.js

Solution

The `methodOverride()` middleware is for requests from clients that only natively support simple verbs like GET and POST. So in those cases you could specify a special query field (or a hidden form field for example) that indicates the real verb to use instead of what was originally sent. That way your backend `.put()`/`.delete()`/`.patch()`/etc. routes don't have to change and will still work and you can accept requests from all kinds of clients.

Problem

Since the `Router` object in Express 4 supports: ``` var router = require('express').Router(); router.delete('/route', function(req, res) { //... }; router.put('/route', function(req, res) { //... }; ``` What use is there for method-override middleware? Can I safely remove it from my `app.js` and `package.json`?

Original source

Related problems