|
|
@ -11,6 +11,7 @@ async function fetch3CatFacts() { |
|
|
const uri = `${CAT_API_ENDPOINT}/facts/random?amount=${CAT_FACTS_COUNT}`; |
|
|
const uri = `${CAT_API_ENDPOINT}/facts/random?amount=${CAT_FACTS_COUNT}`; |
|
|
try { |
|
|
try { |
|
|
const response = await axios.get(uri); |
|
|
const response = await axios.get(uri); |
|
|
|
|
|
console.log() |
|
|
return response.data.map(rep => rep.text); |
|
|
return response.data.map(rep => rep.text); |
|
|
} catch { |
|
|
} catch { |
|
|
return null; |
|
|
return null; |
|
|
@ -49,7 +50,7 @@ async function fetchDaysOfPerCountry(country) { |
|
|
app.post('/', async (req, _res) => { |
|
|
app.post('/', async (req, _res) => { |
|
|
|
|
|
|
|
|
const countryCode = req.body?.countryCode; |
|
|
const countryCode = req.body?.countryCode; |
|
|
const [foxPicture, catFacts, holidays] = Promise.all([ |
|
|
|
|
|
|
|
|
const [foxPicture, catFacts, holidays] = await Promise.all([ |
|
|
fetchFowImage(), |
|
|
fetchFowImage(), |
|
|
fetch3CatFacts(), |
|
|
fetch3CatFacts(), |
|
|
fetchDaysOfPerCountry(countryCode) |
|
|
fetchDaysOfPerCountry(countryCode) |
|
|
|