Advertisement
Guest User

Untitled

a guest
Apr 29th, 2022
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. app.get('/', async (req, res) => {
  2.     let response = await axios.get('api1.com/sale');
  3.     let gamesArr = response.data.game_discounts;
  4.     let games = await Promise.all(gamesArr.map((game) => {
  5.         return axios.get(`api2.com/api/game/${game.OpenCriticID}`)
  6.     }));
  7.     let openCriticId = games.map((response) => {
  8.         return [response.data.name, response.data.medianScore];
  9.     })
  10.  
  11.     console.log(openCriticId);
  12.     res.render('inicio', { gamesArr })
  13. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement