Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

75
Views
Cómo recuperar la API que devuelve el resultado con el mismo orden que el primer parámetro

¿Hay alguna manera de devolver el resultado de fetch API con el mismo pedido req.body , el resultado devuelve un pedido aleatorio?

 exports.bookData = async (req, res) => { let inputList = req.body.isbns; let bookData = []; let price = []; let shipping = []; let headers = { "Content-Type": "application/json", Authorization: "6456_46446548498465", }; let url = `https://api1/${inputList}`; await fetch(url, { headers: headers }) .then((response) => { if (response.ok) { // calculate return response.json(); } }) .then((json) => { if (json) { bookData.push(json); } }); await fetch( `https://api3.com/${inputList}/6465dc68-564h5466g-546f684g86/` ) .then((response) => response.json()) .then((data) => { console.log(data); }); let result = { bookData, price, shipping }; return res.json(result); };

ISBN: 2935689888, 2856989845, 1156464654

producción:

bookData: [ { libro: [Objeto] } ], { precio: '$11.54', enlace: 'https://api/2856989845', },

bookData: [ { libro: [Objeto] } ], { precio: '$15.54', enlace: 'https://api/2935689888', },

bookData: [ { libro: [Objeto] } ], { precio: '$05.54', enlace: 'https://api/1156464654', },

**salida: debe ser **

bookData: [ { libro: [Objeto] } ], { precio: '$15.54', enlace: 'https://api/2935689888', },

bookData: [ { libro: [Objeto] } ], { precio: '$11.54', enlace: 'https://api/2856989845', },

bookData: [ { libro: [Objeto] } ], { precio: '$05.54', enlace: 'https://api/1156464654', },

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!