Last active
June 22, 2020 15:38
-
-
Save AlexSKuznetsov/988d220ba7375e592d3e1b59ecdc4bc6 to your computer and use it in GitHub Desktop.
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 characters
| npm i method-override | |
| 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; | |
| } | |
| })); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment