Reputation: 4751
I'd like to do this in my main-controller.js
file:
var mainController = require( './main-controller' )
exports.add = function ( a, b ) {
return a + b
}
exports.showAdded ( req, res ) {
return res.json( mainController.add( req.query.a, req.query.b ) )
}
But requiring and referencing the current controller seems weird. Is there a way to do something like this instead?
this.add( req.query.a, req.query.b )
Upvotes: 0
Views: 41
Reputation: 11320
Why not var
it:
var add = function (a, b) { };
exports.add = add;
Upvotes: 1