GithubHelp home page GithubHelp logo

Comments (6)

warycat avatar warycat commented on May 22, 2024

same issue

from express-validator.

ctavan avatar ctavan commented on May 22, 2024

#33 (v0.5.0) introduced a breaking change in how to add the middleware. It's now being used the same way as all the standard express middlewares. Instead of

app.use(expressValidator);

you now need to do

app.use(expressValidator());

and you can pass some options as well. Check the README for details.

Let me know if that's the issue.

from express-validator.

thallium205 avatar thallium205 commented on May 22, 2024

This fixes the issue for macs. However, on a Windows environment, the method:

app.use(expressValidator());

throws this error:

node_modules\express-validator\lib\express_validator.js:32
req.updateParam = function(name, value) {
^
TypeError: Cannot set property 'updateParam' of undefined
at expressValidator (node_modules\express-validator\lib\express_validator.js:32:19)
at Function. (app.js:20:13)
at Function.app.configure (node_modules\express\lib\application.js:396:61)
at Object. (app.js:14:5)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)

But, using the old method on Windows:

app.use(expressValidator);

works as expected.

from express-validator.

ctavan avatar ctavan commented on May 22, 2024

I don't think this is OS-related.

Please use

npm ls

to check which version of express-validator you have installed. For versions up to 0.4.x use the old style

app.use(expressValidator);

for versions starting with 0.5.0 use

app.use(expressValidator());

If this did not fix your issue please feel free to re-open this ticket.

from express-validator.

thallium205 avatar thallium205 commented on May 22, 2024

You are correct. My apologies! I was thinking of nodejs versions not library versions.

from express-validator.

lock avatar lock commented on May 22, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

from express-validator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.