From 1499af04ba772a0009bb8826c9a6e2077ac5a05e Mon Sep 17 00:00:00 2001 From: Mostafa Moawad Date: Tue, 6 Apr 2021 18:56:36 +0200 Subject: [PATCH 1/5] keep connection --- nodeapp/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodeapp/app.js b/nodeapp/app.js index b814606..3d670d8 100644 --- a/nodeapp/app.js +++ b/nodeapp/app.js @@ -20,7 +20,7 @@ connection.connect(function(err) { res.send("db connection successful"); console.log('Connected to database.'); -connection.end(); +// connection.end(); });}) const redis = require('redis'); From 684e67a1d2713b526afb72fe8dd144ed2b083834 Mon Sep 17 00:00:00 2001 From: Mostafa Moawad Date: Tue, 6 Apr 2021 19:40:44 +0200 Subject: [PATCH 2/5] Update app.js --- nodeapp/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodeapp/app.js b/nodeapp/app.js index 3d670d8..8f758a2 100644 --- a/nodeapp/app.js +++ b/nodeapp/app.js @@ -20,7 +20,7 @@ connection.connect(function(err) { res.send("db connection successful"); console.log('Connected to database.'); -// connection.end(); + connection.end(); });}) const redis = require('redis'); From ee4b571476928dd57d11d450e3636c463ec45127 Mon Sep 17 00:00:00 2001 From: Mostafa Moawad Date: Tue, 6 Apr 2021 19:42:53 +0200 Subject: [PATCH 3/5] Update app.js --- nodeapp/app.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nodeapp/app.js b/nodeapp/app.js index 8f758a2..0717be9 100644 --- a/nodeapp/app.js +++ b/nodeapp/app.js @@ -13,8 +13,9 @@ app.get("/db", (req, res) => { connection.connect(function(err) { if (err) { + console.error('Database connection failed: ' + err.stack); res.send("db connection failed") - console.error('Database connection failed: ' + err.stack); + return; } res.send("db connection successful"); From b584faea05de428a9deeb06df38cc2a271ef6171 Mon Sep 17 00:00:00 2001 From: Mostafa Moawad Date: Tue, 6 Apr 2021 19:49:25 +0200 Subject: [PATCH 4/5] Update app.js --- nodeapp/app.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nodeapp/app.js b/nodeapp/app.js index 0717be9..725f709 100644 --- a/nodeapp/app.js +++ b/nodeapp/app.js @@ -13,8 +13,9 @@ app.get("/db", (req, res) => { connection.connect(function(err) { if (err) { - console.error('Database connection failed: ' + err.stack); - res.send("db connection failed") +// console.error('Database connection failed: ' + err.stack); +// res.send("db connection failed") + return console.error('error: ' + err.message); return; } From a2f90c5b36bc46c4bdf4365f3ed20cf291228a67 Mon Sep 17 00:00:00 2001 From: Mostafa Moawad Date: Tue, 6 Apr 2021 19:56:37 +0200 Subject: [PATCH 5/5] first state --- nodeapp/app.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nodeapp/app.js b/nodeapp/app.js index 725f709..3e66eae 100644 --- a/nodeapp/app.js +++ b/nodeapp/app.js @@ -13,9 +13,10 @@ app.get("/db", (req, res) => { connection.connect(function(err) { if (err) { -// console.error('Database connection failed: ' + err.stack); -// res.send("db connection failed") - return console.error('error: ' + err.message); + console.log(err) + console.error('Database connection failed: ' + err.stack); + res.send("db connection failed") + //return console.error('error: ' + err.message); return; }