Agent69
Agent69

Reputation: 678

SyntaxError: Unexpected token )

How to resolve 'SyntaxError: Unexpected token )' ?

I creating a route with nodejs

and im getting this error

/var/pbxapi_nodejs/routes/confbridges.js:26
  });
   ^
SyntaxError: Unexpected token )
    at Module._compile (module.js:439:25)

This is my code:

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;

What is the possible cause of this error?

Upvotes: 0

Views: 3217

Answers (1)

Molda
Molda

Reputation: 5704

Your problem is ) after mongodb.model("Confbridge") <<< remove it so it looks like

mongodb.model("Confbridge", function(err, result){

Upvotes: 6

Related Questions