I need load json object from anonymous function to variable instance.
In this example is instance undefined.
I am sure, the solution is simple, but newbie in node and no answer found...:(
module.exports = {
create: function(req,res){
instance = EngineInstance.findById(req.body.engineInstanceId).exec(function(err,instance){
if (err) return res.send(err,500);
if (!instance) return res.send("No engine instance found!", 404);
return instance;
});
namespamce = instance.namespace;...
}
};
instance?