Replace Express APIs removed in Express 5
ProprietaryReplaces app.del(...) with app.delete(...), res.sendfile(...) with res.sendFile(...), res.json(status, body), res.send(status, body) and res.jsonp(status, body) with res.status(status).json(body) (and likewise), res.json(body, status) with a numeric status second argument the same way, and res.redirect('back') with res.redirect(req.get('Referrer') || '/'). Only files that import or require express are changed. An application is a variable assigned express() or express.Router() in the same file, and a response is the second parameter of the enclosing function; the match is by name, not by type, so an application or response that comes from elsewhere is left alone. res.redirect('back') is changed only when the first parameter is available as req.
org. openrewrite. nodejs. migrate. express. ReplaceRemovedExpressApismod run . --recipe= org. openrewrite. nodejs. migrate. express. ReplaceRemovedExpressApisInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.