I create requests from nodejs to server. For different functions I have same auth, so I want to make 1 auth function and use it when we need. But in strict mode this
is undefined
. In not strict mode getUserAuth
is undefined
. Where I'm wrong.
'use strict';
var request = require('request');
module.exports.getUserAuth = function () {
// do some stuff.
return stuff;
};
module.exports.clientCheck = function (req, res) {
var auth = this.getUserAuth();
// make some request with auth;
};
via YoroDiallo
No comments:
Post a Comment