mongoose syntax error

1

I'm trying to create an application using express.js and mongodb, when I try to run the server this syntax error appears. The error that appears refers to a document with only zeros (Ex: 0000 0000 0000 0000 ), I am a noob in the matter.

D:\teste de apps\mean\node_modules\mongoose\node_modules\mongodb\lib\rea  
d_preference.js:1                                                         
(function (exports, require, module, __filename, __dirname) {             
                                                              ^           
SyntaxError: Unexpected token ILLEGAL                                     
    at Module._compile (module.js:439:25)                                 
    at Object.Module._extensions..js (module.js:474:10)                   
    at Module.load (module.js:356:32)                                     
    at Function.Module._load (module.js:312:12)                           
    at Module.require (module.js:364:17)                                  
    at require (module.js:380:17)                                         
    at Object.<anonymous> (D:\teste de apps\mean\node_modules\mongoose\l  
ib\utils.js:5:16)                                                         
    at Module._compile (module.js:456:26)                                 
    at Object.Module._extensions..js (module.js:474:10)                   
    at Module.load (module.js:356:32) 

// MEAN-APP / config / mongoose.js

var config = require('./config');
var mongoose = require('mongoose');

module.exports = function(){
    var db = mongoose.connect(config.db);
    require('../app/models/user.server.model');
    return db;
};

// MEAN-APP / config / env / development.js

module.exports = {
    db: 'mongodb://localhost/mean-book',
    // Development configuration options
    // the sessionSecret string can be anything
    sessionSecret: 'developmentSessionSecret'
}

// MEAN-APP / server.js

process.env.NODE_ENV = process.env.NODE_ENV || 'development';

var mongoose = require('./config/mongoose');
var express = require('./config/express');

var db = mongoose();
var app = express();

app.listen(3000);

module.exports = app;

console.log('Server running at http://localhost:3000/');

// MEAN-APP / config / express.js

var session     = require('express-session'),
    config      = require('./config'),
    express     = require('express'),
    morgan      = require('morgan'),
   compress     = require('compression'),
 bodyParser     = require('body-parser'),
 methodOverride = require('method-override'),
    mongoose    = require('mongoose');

module.exports= function(){
    var app = express();
    if(process.env.NODE_ENV === 'development'){
        app.use(morgan('dev'));
    } else if (process.env.NODE_ENV ==='production'){
        app.use(compress());
    }
    app.use(bodyParser.urlencoded({
        extended : true
    }));

    app.use(bodyParser.json());
    app.use(methodOverride());

    app.use(session({
        saveUninitialized: true,
        resave: true,
        secret: config.sessionSecret
    }));

    app.set('views', './app/views');
    app.set('view engine', 'ejs');

    require('../app/routes/index.server.routes.js')(app);

    app.use(express.static('./public'));

    return app;
}
    
asked by anonymous 26.03.2015 / 23:14

0 answers