Last active
June 22, 2020 15:38
-
-
Save AlexSKuznetsov/988d220ba7375e592d3e1b59ecdc4bc6 to your computer and use it in GitHub Desktop.
Revisions
-
AlexSKuznetsov revised this gist
Jun 22, 2020 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ npm i method-override const methodOverride = require(‘method-override’) // Разрешает использовать PUT, DELETE с формами. -
AlexSKuznetsov created this gist
Jun 22, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ const methodOverride = require(‘method-override’) // Разрешает использовать PUT, DELETE с формами. app.use(methodOverride(function (req, res) { if (req.body && typeof req.body === 'object' && '_method' in req.body) { // look in urlencoded POST bodies and delete it const method = req.body._method; delete req.body._method; return method; } }));