https://stackoverflow.com/questions/33078967/node-js-call-a-local-function-within-module-exports/33080602
I think I got it. I just changed
this.foo()
to module.exports.foo()
and it seems to be working.
If someone has a better or more proper method, please feel free to correct me.
"use strict"
var self = module.exports = {
myName : function(req, res, next) {
// accessing method within controller
self.getName(data);
},
getName : function(data) {
// code
}
}
Không có nhận xét nào:
Đăng nhận xét