question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Calling imperatively from controller does not work

See original GitHub issue

Hello:

I’m trying to use express-validator imperative call in a controller as described in here. https://express-validator.github.io/docs/running-imperatively.html .

My code:

var myMethod = async function (req, res, next) {
  await body('email').isEmail().run(req);

  var errors = validationResult(req);
  console.log(errors);
}

The console will log an empty array if email is not present or email is invalid.

This code belongs to a controller, if I use the validation chain as a middleware it works as expected.

Thanks in advance.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
gustavohenkecommented, Jun 27, 2019

👋 this has been published to v6.1.0 🚢

1reaction
asolenzalcommented, Jun 28, 2019

Thanks @gustavohenke great response time. Will look at some issues to see on what can I help you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error calling Apex imperatively from LWC in a JavaScript ...
But for some special reasons, I keep on getting this error on my browser "[F.default(...).then(...).error is not a function]" can anyone help ...
Read more >
Call Apex Methods Imperatively - Salesforce Developers
To work with objects that aren't supported by User Interface API, like Task and Event. To call a method from an ES6 module...
Read more >
Understand async & await scenarios in Lightning Web ...
Understand async & await scenarios in Lightning Web Component which helps you to control imperative public apex method calls.
Read more >
Calling the apex Method using imperative way LWC
Things to remember before you call apex method with imperative in LWC. Apex controller method should be static; It should annotated with @AuraEnable....
Read more >
LWC - Call Apex Imperatively - YouTube
1 Salesforce Training Tutorialshttps://www.sown.ioAn alternative to calling Apex with @wire is to call Apex imperatively.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found