如何解决' SyntaxError:意外的令牌)' ?
我使用nodejs创建路由
我即将收到此错误
/var/pbxapi_nodejs/routes/confbridges.js:26
});
^
SyntaxError: Unexpected token )
at Module._compile (module.js:439:25)
这是我的代码:
var confbridges = express.Router();
var appInit = require('../app');
var basedir = appInit.basedir;
var logger = appInit.logger;
var config = appInit.config;
var mongodb = appInit.mongodb;
var _ = appInit.underscore;
confbridges.get('/conference/confbridges/:circle/:confUid', function(req, res) {
var confbridges = [];
mongodb.model("Confbridge"), function(err, result){
var confbridges = JSON.parse(JSON.stringify(result));
if(confbridges.length > 0){
res.json(confbridges);
}else{
res.json(confbridges);
}
});
});
module.exports = confbridges;
出现此错误的可能原因是什么?
答案 0 :(得分:4)
)
删除后问题为mongodb.model("Confbridge") <<<
,看起来像是
mongodb.model("Confbridge", function(err, result){