/**
 * Created by fran lopez on 06/12/15.
 */

    /**
     * Definition of 'NODE_ENV' environment variable. If localhost system
     * hasn't defined this variable, the source code will define it with
     * "development" value.
     */

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

    /**
     * Calling to CommonJS configuration modules for Mongoose Express Module, and
     * Express Node Module. Later, the source code define two objects to call the
     * main function implemented in these modules.
     */

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

    /**
     * Node Express Application will listen all request from 3000 port.
     */

    app.listen(3000);

    /**
     * Like a any CommonJS module from NodeJS, this main module returns a
     * Express Application Object with all MEAN application.
     */

    module.exports = app;

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