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

136
Views
why return "Promise { <pending> }" all the times?
exports.getNews = async (category) =>{ //get a promise from api for display it in mustach template

  exports.fetch_news_from_API =  async (category) => { // get data from api
    /* get data from api*/
    return data.articles; // promise
  }

  exports.getData = async (data) =>{ // add an id for every news
    let finalData = [];
    for(let i = 0; i < data.length; i++){
      let news = {
        id : i,
        title : data[i].title,  //api object
        author : data[i].author,
        description : data[i].description,
        publishedAt : data[i].publishedAt,
      }
      finalData.push(news);
    }
    return finalData; // news
  }
  
  let data = await this.fetch_news_from_API(category);
  let news = await this.getData(data);
  return news; // return pending all the time whene i use it in app.get
}

I would like to use "news" to display it but I can not because it returns all the time "pending" thank you in advance

about 4 years ago · Santiago Trujillo
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!