NestJS · Junior · Question 73 of 75

How do you call an external HTTP API from a Nest service in the Nest way?

Explanation

HttpService returns Observables; firstValueFrom() turns them into promises. Plain fetch works too. Always set timeouts.

Further reading

Problem with a question

NestJS · Junior · question 73

Test yourself

Take the NestJS · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz