How do you call a function from within another function in a module.exports
declaration?
var bla = require(\'./bla.js\');
console.log(bl
To fix your issue, i have made few changes in bla.js and it is working,
var foo= function (req, res, next) {
console.log('inside foo');
return ("foo");
}
var bar= function(req, res, next) {
this.foo();
}
module.exports = {bar,foo};
and no modification in app.js
var bla = require('./bla.js');
console.log(bla.bar());
const Service = {
foo: (a, b) => a + b,
bar: (a, b) => Service.foo(a, b) * b
}
module.exports = Service