text: 'use strict';
  /**
   * Module dependencies.
   */
  var init = require('./config/init')(),
  	config = require('./config/config'),
  	mongoose = require('mongoose'),
  	chalk = require('chalk');
  
  /**
   * Main application entry file.
   * Please note that the order of loading is important.
   */
  
  // Bootstrap db connection
  var db = mongoose.connect(config.db, function(err) {
  	if (err) {
  		console.error(chalk.red('Could not connect to MongoDB!'));
  		console.log(chalk.red(err));
  	}else{
  		console.log(chalk.green('Connected'));
  		console.log(chalk.green(mongoose.version.split('.')[0]));
  
  	}
  });
  
  // Access the mongoose-dbref module and the utilities
  // var dbref = require('mongoose-dbref');
  // var utils = dbref.utils;
  
  // // Install the monkey patches
  // var loaded = dbref.install(mongoose);
  
  
  // Init the express application
  var app = require('./config/express')(db);
  
  // Bootstrap passport config
  require('./config/passport')();
  
  // Start the app by listening on <port>
  app.listen(config.port);
  
  // Expose app
  exports = module.exports = app;
  
  // Logging initialization
  console.log('MEAN.JS application started on port ' + config.port);