/** * Módulos necesarios */ var express = require('express'); var app = module.exports = express(); var bodyParser = require('body-parser'); var settings = require('./Application/settings.js'); var mail = require('./Application/mail.js'); var logger = require('./Application/logger.js'); var database = require('./Application/database.js'); var terminal = require('./Application/Util/terminal.js'); // Middleware app.use(bodyParser.json()); app.use(bodyParser.urlencoded({extended: true})); // Cargar rutas app.use('/', require('./Application/router.js')); app.start = function() { return app.listen(settings.port, function() { terminal.printHeader(); mail.init(); database.init(); logger.print(__LOG_INFO, 'Servidor de correo iniciado en el puerto ' + settings.port); if (settings.debug) { logger.print(__LOG_WARNING, 'El modo debug está activado'); } }); }; if (require.main === module) { app.start(); }