/**
 * Main application file
 */

'use strict';

// Set default node environment to development
process.env.NODE_ENV = process.env.NODE_ENV || 'development';

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

// Connect to database
mongoose.connect(config.mongo.uri, config.mongo.options);

// Populate DB with sample data
//var envConfig = require('./config/seed.js');
//if (config.seedDB) {
//    envConfig.local();
//}

//if (config.env === 'production') {
//    envConfig.prod();
//}

// Setup server
var app = express();
var server = require('http').createServer(app);
var socketio = require('socket.io')(server, {
    serveClient: config.env !== 'production',
    path: '/socket.io-client'
});
require('./config/socketio').init(socketio);
require('./config/express').init(app);
require('./routes').init(app);

// Start server
server.listen(config.port, config.ip, function () {
    console.log('Express server listening on %d, in %s mode', config.port, app.get('env'));
});

//, config.ip || localhost, function () {
//    console.log('Express server listening on %d, in %s mode', config.port, app.get('env'));
//});

// Expose app
module.exports = app;

@@ -383,206 +383,8 @@
 );%0A%0A
-// Populate DB with sample data%0A//var envConfig = require('./config/seed.js');%0A//if (config.seedDB) %7B%0A//    envConfig.local();%0A//%7D%0A%0A//if (config.env === 'production') %7B%0A//    envConfig.prod();%0A//%7D%0A%0A
 // S
@@ -875,151 +875,8 @@
 );%0A%0A
-//, config.ip %7C%7C localhost, function () %7B%0A//    console.log('Express server listening on %25d, in %25s mode', config.port, app.get('env'));%0A//%7D);%0A%0A
 // E

clean up;