From 5cc5a7af0d6536ed8bb1f0ddcde11a6424e45916 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Tue, 9 Jul 2019 16:31:04 -0400 Subject: [PATCH] Made it send 404 when nothing is found --- index.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 8062824..f16c59e 100644 --- a/index.js +++ b/index.js @@ -37,10 +37,14 @@ app.get('/api/getVideoSponsorTimes', function (req, res) { sponsorTimes[i][1] = rows[i].endTime; } - //send result - res.send({ - sponsorTimes: sponsorTimes - }) + if (sponsorTimes == []) { + res.sendStatus(404); + } else { + //send result + res.send({ + sponsorTimes: sponsorTimes + }) + } }); });