PUT and DELETE - estermer/ericstermer.com GitHub Wiki
First to do a PUT and DELETE we must have a method-override
npm install --save method-override
Next require it:
var methodOverride = require('method-override');
Then use it through express app:
app.use(methodOverride('_method'));
This will allow us to override the GET and POST methods that are automatically installed HTTP methods
Then in our forms we can set our method and action as such:
PUT - <form action="/example/{{id}}?_method=Put" method="POST">
DELETE - <form action="/example/{{id}}?_method=Delete" method="POST">
And our server method can now be:
PUT - app.put('/example/:id', function(req,res){});
DELETE - app.delete('/example/:id', function(req,res){});