我需要将 json 对象从匿名函数加载到变量实例。
在这个例子中是未定义的实例。
我敢肯定,解决方案很简单,但是节点中的新手并没有找到答案......:(
模块.exports = {
创建:函数(req,res){
instance = EngineInstance.findById(req.body.engineInstanceId).exec(function(err,instance){
if (err) return res.send(err,500);
if (!instance) return res.send("找不到引擎实例!", 404);
返回实例;
});
命名空间 = 实例.命名空间;...
}
};