My userProfileController.js result is undefined
var UserProfileSerice = require('../../Services/User/UserProfileService.js');
module.exports = function(app){
app.get('/tester' , ensureAuthenticated, function(req, res){
var sonuc ;
UserProfileSerice.getUserByEmail(function(result){
sonuc = result;
})
console.log('sonuc' +sonuc);
res.render('UserPages/userPage');
})
}
and
this function is inside UserProfileSerice.js file I can not get the result that callback is not working
var UserModel = require('../../Models/User/UserModel.js');
var thinktConfig = require('../../Utils/rethinkdb/config.js');
var thinky = require('thinky')(thinktConfig.rethinkdb);
module.exports ={
getUserByEmail : function (callback) {
UserModel.filter({email: "slmkrnz@gmail.com"}).run().then(function(result) {
callback(result);
});
}}