1

I am developing a simple application in nodejs using sailsjs framework.

My task is to create an api endpoint,on which i have to validate the incoming paramter from db whether it is valid or not.

if input parameter is not valid then I will return error in JSON Format if input parameter is valid then I need to do some calculation, and then save them to database ,then send a mail and give success response in JSON Format.

The confusion is if i use async how I force async not to call the next function when input parameter is not valid.

pkd
  • 504
  • 5
  • 13

1 Answers1

1

Since you have not posted your code yet, I'm not sure if this is the answer you're looking for. But my suggestion is that you evaluate the input parameter inside the callback function.

Here's more information on how to make your own callback function. Which may also help you in solving your problem.

Community
  • 1
  • 1
Daniël J
  • 107
  • 10