2017-05-30 06:06:14 +00:00
|
|
|
/**
|
|
|
|
* Módulos necesarios
|
|
|
|
*/
|
|
|
|
var express = require('express');
|
2017-05-31 11:46:18 +00:00
|
|
|
var app = express();
|
2017-05-30 06:06:14 +00:00
|
|
|
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'));
|
|
|
|
|
2017-05-31 11:46:18 +00:00
|
|
|
// Iniciar escucha del servidor
|
|
|
|
app.listen(settings.app().port, function() {
|
|
|
|
// Imprimir cabecera
|
|
|
|
terminal.printHeader();
|
2017-05-30 06:06:14 +00:00
|
|
|
|
2017-05-31 11:46:18 +00:00
|
|
|
// Escucha SMTP
|
|
|
|
mail.init();
|
|
|
|
|
|
|
|
// Iniciar base de datos
|
|
|
|
database.init();
|
|
|
|
|
|
|
|
logger.print(__LOG_INFO, 'Servidor de correo iniciado en el puerto ' + settings.app().port);
|
|
|
|
|
|
|
|
if (settings.debug) {
|
|
|
|
logger.print(__LOG_WARNING, 'El modo debug está activado');
|
|
|
|
}
|
|
|
|
});
|
2017-05-30 06:06:14 +00:00
|
|
|
|