From d16419438617f5578b47b944a55abfa860623ae3 Mon Sep 17 00:00:00 2001 From: Pierre Date: Mon, 15 Feb 2021 17:57:51 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8hollidays?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index d214261..fdb137a 100644 --- a/index.js +++ b/index.js @@ -17,13 +17,21 @@ async function getFox() { return image; } +async function getHolidays(country) { + const response = await axios.get(`https://date.nager.at/api/v2/publicholidays/2017/${country}`); + const data = await response.data; + return data; +} + app.post('/', async (req, res) => { const catInfos = await getCat(); - const foxImage = await getFox(); + const image = await getFox(); + const hollidays = await getHolidays(req.body.countryCode); return { message: `Welcome to Node Babel`, catFacts: catInfos, - fox: foxImage, + foxImage: image, + publicHolidays :hollidays }; });