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.