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 auth = require('./services/auth/server/server.js');
var client = require('./services/client/server/server.js'); var client = require('./services/client/server/server.js');
var server = require('./services/salix/server/server.js'); var server = require('./services/salix/server/server.js');
var mailer = require('./services/mailer/server.js');
auth.start(); auth.start();
client.start(); client.start();
server.start(); server.start();
mailer.start();
}); });

View File

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

View File

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

View File

@ -2,7 +2,7 @@
* Módulos necesarios * Módulos necesarios
*/ */
var express = require('express'); var express = require('express');
var app = express(); var app = module.exports = express();
var bodyParser = require('body-parser'); var bodyParser = require('body-parser');
var settings = require('./Application/settings.js'); var settings = require('./Application/settings.js');
@ -18,21 +18,20 @@ app.use(bodyParser.urlencoded({extended: true}));
// Cargar rutas // Cargar rutas
app.use('/', require('./Application/router.js')); app.use('/', require('./Application/router.js'));
// Iniciar escucha del servidor
app.listen(settings.port, function() { app.start = function() {
// Imprimir cabecera return app.listen(settings.port, function() {
terminal.printHeader(); terminal.printHeader();
// Escucha SMTP
mail.init(); mail.init();
// Iniciar base de datos
database.init(); database.init();
logger.print(__LOG_INFO, 'Servidor de correo iniciado en el puerto ' + settings.port); logger.print(__LOG_INFO, 'Servidor de correo iniciado en el puerto ' + settings.port);
if (settings.debug) { if (settings.debug) {
logger.print(__LOG_WARNING, 'El modo debug está activado'); logger.print(__LOG_WARNING, 'El modo debug está activado');
} }
}); });
};
if (require.main === module) {
app.start();
}