Die Connect.js sehr knappe Dokumentation sagt methodOverride
Bietet Unterstützung für falsche HTTP-Methoden.
Was bedeutet das? Die offensichtliche Google-Suche ist weniger als hilfreich. Warum ist methodOverride
nützlich?
DELETE
und PUT
simulieren möchten, ist methodOverride
dafür.app.delete
und app.put
in Express anstelle von app.post
die ganze Zeit (also beschreibender, ausführlicher):Backend:
// the app
app.put('/users/:id', function (req, res, next) {
// edit your user here
});
Client-Logik:
// client side must be..
<form> ...
<input type="hidden" name="_method" value="put" />
</form>