I have a controller with two functions:
module.exports.getQuestionnaire = function(application, req, res) {
}
module.exports.getClientDetails = function(application, req, res) {
}
I want to call the getQuestionnaire function inside the getClientDetails function.
Just calling getQuestionnaire() does not work. How should I do this?
What I usually do:
const getQuestionnaire = () => {
//getClientDetails()
}
const getClientDetails = () => {
//getQuestionnaire()
}
module.exports = {getQuestionnaire, getClientDetails}
Define each one as a separate function and then export the functions. Then you can also use the functions on the page
function getQuestionnaire(application, req, res) { }
function getClientDetails (application, req, res) { }
module.exports = {getQuestionnaire, getClientDetails}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With