Online API

This page talks to jsonplaceholder.typicode.com, a free practice API on the internet.

1. fetch with async / await and try / catch

An action that uses await is async by itself.

  • Leanne Graham Sincere@april.biz · Gwenborough
  • Ervin Howell Shanna@melissa.tv · Wisokyburgh
  • Clementine Bauch Nathan@yesenia.net · McKenziehaven
  • Patricia Lebsack Julianne.OConner@kory.org · South Elvis
  • Chelsey Dietrich Lucio_Hettinger@annie.ca · Roscoeview
  • Mrs. Dennis Schulist Karley_Dach@jasper.info · South Christy
  • Kurtis Weissnat Telly.Hoeger@billy.biz · Howemouth
  • Nicholas Runolfsdottir V Sherwood@rosamond.me · Aliyaview
  • Glenna Reichert Chaim_McDermott@dana.io · Bartholomebury
  • Clementina DuBuque Rey.Padberg@karina.biz · Lebsackbury

2. load: no try / catch needed

load posts = online.get('/posts', { query: { userId } }) loads again by itself when userId changes.

Network error: RequestInit: Expected signal ("AbortSignal {}") to be an instance of AbortSignal.

3. Every HTTP action with api

JSON goes out and comes back by itself; a failed answer throws an ApiError with status.

4. Answers per second

Sends GET /posts/1, /posts/2… from your browser and times every answer. The result depends on your internet connection and on the server.