From 16c040410327fd5798e86738cbab694ecc2cc711 Mon Sep 17 00:00:00 2001 From: André Araújo Date: Thu, 25 Aug 2016 18:48:33 -0300 Subject: [PATCH] Adiciona endpoint /countVideo --- .gitignore | 10 +++++++--- routes/index.js | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 45ef68f..ca53a85 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,10 @@ -*.webm +.* +!*.gitignore +*~ + *.blend *.mp4 -*.zip +*.nohup *.tar.gz - +*.webm +*.zip diff --git a/routes/index.js b/routes/index.js index c0e24f0..be964c9 100644 --- a/routes/index.js +++ b/routes/index.js @@ -24,6 +24,21 @@ router.get('/', function(req, res, next) { res.render('index', { title: 'Express' }); }); +router.get('/countVideo', function(req, res, next) { + var results = []; + db.query('SELECT COUNT(*) FROM sinal') + .then(function (result) { + res.send(203, [parseInt(result[0].count)]); + }) + .catch(function (error) { + res.send(203, ["Error: Invalid Query"]); + console.log(error); + }) + .finally(function() { + pgp.end(); + }); +}); + router.get('/listall', function(req, res, next) { var results = []; -- libgit2 0.21.2