From f23bc6e44f0b02f8761b0c0f995b35a88fb576d7 Mon Sep 17 00:00:00 2001 From: anthony Date: Mon, 14 Feb 2022 09:26:32 +0100 Subject: [PATCH] Fix typos --- index.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 107fdaa..f5f099e 100644 --- a/index.js +++ b/index.js @@ -4,6 +4,8 @@ import axios from 'axios'; const app = fastify({logger: true}); +// CAT FACTS + const CAT_API_ENDPOINT = "https://cat-fact.herokuapp.com"; const CAT_FACTS_COUNT = 3; @@ -11,16 +13,17 @@ async function fetch3CatFacts() { const uri = `${CAT_API_ENDPOINT}/facts/random?amount=${CAT_FACTS_COUNT}`; try { const response = await axios.get(uri); - console.log() return response.data.map(rep => rep.text); } catch { return null; } } +// FOX API + const FOX_API_ENDPOINT = 'https://randomfox.ca/floof'; -async function fetchFowImage() { +async function fetchRandomFoxImage() { try { const response = await axios.get(FOX_API_ENDPOINT); return response.data.image; @@ -29,9 +32,11 @@ async function fetchFowImage() { } } +// OFF DAYS + const DAYS_OFF_API_ENDPOINT = "https://date.nager.at" -async function fetchDaysOfPerCountry(country) { +async function fetchDaysOffPerCountry(country) { if (country) { return null; @@ -48,12 +53,11 @@ async function fetchDaysOfPerCountry(country) { } app.post('/', async (req, _res) => { - const countryCode = req.body?.countryCode; const [foxPicture, catFacts, holidays] = await Promise.all([ - fetchFowImage(), + fetchRandomFoxImage(), fetch3CatFacts(), - fetchDaysOfPerCountry(countryCode) + fetchDaysOffPerCountry(countryCode) ]) return {