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

294
Views
javascript, nodejs, solicitud de tiempo

¿Qué tengo que hacer para que esto funcione? He probado que el GET está regresando con éxito y estoy recibiendo el res.body que estoy esperando.

Pero, por supuesto, x es 'indefinido' porque la llamada a getSometing() no va a esperar en requestify()

 var x = getSomething(); function getSomething() { requestify.get('url') .then(function res) { return(res.body); }) .fail(function err) { return("something happened"); }); }
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Yo fui con:

 var x = getSomething(); function getSomething() { return new Promise(resolve => { requestify.get('url') .then(function res) { resolve(res.body); }) .fail(function err) { resolve("something happened"); }); }); }

Esto garantiza que x tendrá algo; lluvia o sol; y eso es exactamente lo que quiero.

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