Comments (6)
same issue
from express-validator.
#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.
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.
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.
You are correct. My apologies! I was thinking of nodejs versions not library versions.
from express-validator.
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)
- Validation on nested fields not working. HOT 1
- validationResult function don't give any Error HOT 3
- Empty array as default value not working. HOT 1
- isDate() returns false on "2021-02-12" for express-validator v7 HOT 5
- Re-use validators on the front end? HOT 3
- How to pass parameters to a custom validator using schemas HOT 2
- TS Error. Type 'IsURLOptions' does not include some properties
- const {query} = require("express-validator") not working but {check} is working HOT 1
- How to stop the validation flow to different checks HOT 1
- How can I prevent isStrongPassword() accepting whitespaces? HOT 1
- Validate json object HOT 6
- Able to use validation inside controller? HOT 5
- How to use if inside ParamSchema? HOT 1
- Check if a field is either a string or an Array of Strings HOT 1
- Using oneOf together with checkExact causes Unknown Field errors HOT 2
- How to keep keys for optional fields in matchedData?
- Build failed in master branch HOT 2
- Return ValidationChain inside a function. HOT 1
- notEmpty Validation Fails to Detect Empty String with Spaces, Allowing Insertion of Empty String into Database" HOT 1
- Syntax error in example of ValidationError type in express-validator/src/base.ts
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from express-validator.