Node.js Academy

Fetching APIs

#ege-academy-nodejs @rbung @yagong

What is it For ?

Fetching data from another web services

#ege-academy-nodejs @rbung @yagong

How ?

  • Over HTTP protocol

  • HTTP method (GET, POST, PUT, DELETE)

  • HTTP status (200, 201, 204, 404)

  • JSON

#ege-academy-nodejs @rbung @yagong

events & callbacks

callbacks

promises

async/await

cool libraries

The evolution

#ege-academy-nodejs @rbung @yagong

Which modules ?

There's a lots of options !

#ege-academy-nodejs @rbung @yagong

How to test ?

  • Jest (callback, promise, async/await)

  • Nock (mock http server)

#ege-academy-nodejs @rbung @yagong

#ege-academy-nodejs @rbung @yagong

https://reqres.in/

#ege-academy-nodejs @rbung @yagong

Node.js academy - Fetching APIs

By Rodolphe BUNG

Node.js academy - Fetching APIs

  • 841