salix/services/mailer/server.js

35 lines
870 B
JavaScript
Raw Normal View History

2017-05-30 06:06:14 +00:00
/**
* Módulos necesarios
*/
var express = require('express');
2017-05-30 06:50:16 +00:00
var app = module.exports = 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 database = require('./application/database.js');
2017-05-30 06:06:14 +00:00
// Middleware
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
// Cargar rutas
app.use('/', require('./application/router.js'));
2017-05-30 06:06:14 +00:00
// Iniciar escucha del servidor
2017-05-31 12:55:41 +00:00
app.start = function() {
return app.listen(settings.app().port, function() {
mail.init();
database.init();
console.log('Servidor de correo iniciado en el puerto ' + settings.app().port);
2017-05-31 12:55:41 +00:00
if (settings.app().debug) {
console.log('El modo debug está activado');
2017-05-30 06:50:16 +00:00
}
});
};
if (require.main === module) {
app.start();
}
2017-05-30 06:06:14 +00:00
2017-05-30 06:06:14 +00:00