HTTP Module — Techniques · NestJS

Call another service from the cats API: HttpModule with a timeout, HttpService's observables turned into promises, and every way the upstream can fail translated into the right status for your own client.

What you will learn

Read the theory for HTTP Module

All Techniques lessons

All NestJS courses

loading types…

What you'll learn

  • Import HttpModule with options and make requests through HttpService, converting its observables with firstValueFrom
  • Read an AxiosError: response status, timeout code, no response at all
  • Translate upstream failures into NotFoundException, GatewayTimeoutException and BadGatewayException instead of leaking a 500