From 1b7b9a00e0db41c27911f5d0e5e0b7167435ec8b Mon Sep 17 00:00:00 2001 From: DanielRamirezGe Date: Mon, 6 Jul 2020 01:13:56 -0500 Subject: [PATCH] sin cerrar conecciones --- routes/registro.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/routes/registro.js b/routes/registro.js index dc04508..086a8b5 100644 --- a/routes/registro.js +++ b/routes/registro.js @@ -56,7 +56,7 @@ app.post('/registro', async(req, res) => { let cad = `SELECT * FROM Persona WHERE correo='${n_correo}' AND lider = true;`; let respuesta = await query(cad); if (respuesta.length != 0) { - connection.end(); + console.log( "El correo del lider ya fue registrado anteriormente"); res.status(400).json({ error: false, msj: "El correo del lider ya fue registrado anteriormente" }); return; @@ -64,7 +64,7 @@ app.post('/registro', async(req, res) => { } catch(error){ - connection.end(); + let men = `Errror al buscar el correo ${error}`; console.log(men); res.status(400).json({ error: true, msj: men }); @@ -80,7 +80,7 @@ app.post('/registro', async(req, res) => { console.log(`respuesta: ${ans}`); } catch(error){ - connection.end(); + let men = `Error al registar Equipo ${error}`; console.log(men); res.status(400).json({ error: true, msj: men }); @@ -110,7 +110,7 @@ app.post('/registro', async(req, res) => { await query(cad); } catch(error){ - connection.end(); + let men = `Error al registar Integrantes ${error}` console.log(men); res.status(400).json({ error: true, msj: men }); @@ -149,14 +149,14 @@ app.post('/registro', async(req, res) => { let men = `Error al enviar mensaje: ${error}`; console.log(men); res.status(400).json({ error: true, msj: men }); - connection.end(); + return; } else { console.log('Email sent: ' + info.response); res.status(200).json({ error: false, msj: "exito"}); - connection.end(); + return; } @@ -166,7 +166,7 @@ app.post('/registro', async(req, res) => { let men = `Error al enviar mensaje: ${error}`; console.log(men); res.status(400).json({ error: true, msj: men }); - connection.end(); + return; }