From 57816c11b28da8de5ab711c1beaa5dbdfcf3c751 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?In=C3=A8s=20Yeterian?= <ines.yeterian@student-cs.fr> Date: Mon, 14 Feb 2022 15:53:44 +0100 Subject: [PATCH] try to find last toucan in a fast way --- backend/routes/routesToucan.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/routes/routesToucan.js b/backend/routes/routesToucan.js index 19448c6..a5f46c7 100644 --- a/backend/routes/routesToucan.js +++ b/backend/routes/routesToucan.js @@ -149,11 +149,12 @@ router.get('/pdf/:year/:title', (req, res) => { }); }); -router.get('/pdf/lastToucan', (res) => { +router.get('/pdf/lastToucan', (req, res) => { Toucan.find() .exec(function(err, toucans){ if(err) {res.send(err);} - else{ + else + { var max = new Date(toucans[0].date); var idMax = toucans[0]._id; const nbToucans = toucans.length; -- GitLab