Syntax Error: unexpected Token {
<p>Here is my Model:</p>

<pre><code>var mongoose = require('mongoose');

var partySchema = new mongoose.Schema({
  partyCode: Number,
  partyName: String,
  mobileNo: String
});

var Party = module.exports = mongoose.model('Party', partySchema);

module.exports.getAllParties = function(callback){
  Party.find().lean().exec(function(err, parties){
    if (err) return callback(err, null);
    callback(null, parties);
  });
};
</code></pre>

<p>Here is the Route:</p>

<pre><code>router.get('/', function(req, res, next){

  //retrieve all parties from Party model
  //mongoose.model('Party').find({}, function (err, parties) {
  Party.getAllParties(err, parties){
        if (err) {
            return console.error(err);
        } else {
            //respond to both HTML and JSON. JSON responses require 'Accept: application/json;' in the Request Header
            res.format({

              //response in dust or jade files
              html: function(){
                  res.render('Party', {
                        title: 'Party',
                        "parties" : parties
                    });
              },

              //JSON response will show all parties in JSON format
              json: function(){
                  res.json(parties);
              }
          });
        }
  };
});
</code></pre>

<p>At line no 9 in Route.js (Here in above code line no.4) I get an error:</p>

<pre><code>  Party.getAllParties(err, parties){
</code></pre>

<p><strong>Syntax error: {unexpected token</strong></p>

<p>Why is it unexpected? Can't I use a function's body here???</p>