Eexpressjs

expressjs/explicit-request-params

Migrates usage of the legacy APIs `req.param(name)` to the current recommended approaches

transformationmigrationexpressparams
Public
1 executions
1 stars
How to Use
Run this codemod on your codebase using one of the following commands

The easiest way to run this codemod without installing anything globally:

Documentation

Migrate legacy req.param(name)

The req.param(name) helper that used to magically look up values from multiple places has been removed. This potentially confusing and dangerous method of retrieving form data has been removed. You will now need to specifically look for the submitted parameter name in the req.params, req.body, or req.query object.

Examples

Replacing req.param('body') and req.param('query')

Replace req.param('body') with req.body and
req.param('query') with req.query.

diff

Replacing req.param('paramName')

Replace req.param('paramName') with req.params.paramName.

diff

References

Ready to contribute?

Build your own codemod and share it with the community.