What's the role of the method-override middleware in Express 4?
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.