gulp services y service mailer

This commit is contained in:
Vicente Falco 2017-05-30 08:50:16 +02:00
parent 04aadb76a2
commit 2dab567b98
4 changed files with 33 additions and 29 deletions

View File

@ -158,8 +158,10 @@ gulp.task('services', function() {
var auth = require('./services/auth/server/server.js');
var client = require('./services/client/server/server.js');
var server = require('./services/salix/server/server.js');
var mailer = require('./services/mailer/server.js');
auth.start();
client.start();
server.start();
mailer.start();
});

View File

@ -10,6 +10,9 @@
"auth": {
"user": "",
"pass": ""
},
"tls":{
"rejectUnauthorized": false
}
},
"senderMail": "nocontestar@verdnatura.es",
@ -17,7 +20,7 @@
"mysql": {
"host": "test-db.verdnatura.es",
"port": 3307,
"user": "reports",
"user": "",
"password": "",
"database": "vn2008"
}

View File

@ -4,10 +4,10 @@
"description": "Servidor de envío de correos",
"main": "server.js",
"dependencies": {
"mysql": "^2.13.0",
"express": "^4.15.3",
"body-parser": "^1.17.2",
"nodemailer": "^4.0.1",
"mustache": "^2.3.0"
"express": "^4.15.3",
"mustache": "^2.3.0",
"mysql": "^2.13.0",
"nodemailer": "^4.0.1"
}
}

View File

@ -2,7 +2,7 @@
* Módulos necesarios
*/
var express = require('express');
var app = express();
var app = module.exports = express();
var bodyParser = require('body-parser');
var settings = require('./Application/settings.js');
@ -18,21 +18,20 @@ app.use(bodyParser.urlencoded({extended: true}));
// Cargar rutas
app.use('/', require('./Application/router.js'));
// Iniciar escucha del servidor
app.listen(settings.port, function() {
// Imprimir cabecera
app.start = function() {
return app.listen(settings.port, function() {
terminal.printHeader();
// Escucha SMTP
mail.init();
// Iniciar base de datos
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();
}