Skip to content

very basic webpage to display where the International Space Station is, updates each second

Notifications You must be signed in to change notification settings

Rowan-Strang/Live-ISS

Repository files navigation

Consuming external APIs directly from the browser - Choose your own adventure!

This exercise is about exploring the world of APIs available to us.

In addition to hitting our own APIs with JavaScript, we can also make use of APIs exposed from all around the Internet! As to how the API works (and what routes are exposed to us) depends on how it was coded by the developer or team of developers who created it, part of learning how to use external APIs is also about learning how to read their documentation.

Setup

0. Cloning and installation

  • Clone this repo, navigate to it, install packages, and start the server with npm run dev

    Tip
    cd consuming-clientside-apis
    npm i
    npm run dev

Requirements

1. Choosing an API

  • Choose an API to work with

Some possibilities are listed below if you want a place to start, otherwise find one of your own!

2. Building API calls

  • Create the functions that make your API calls in client/apiClient.ts, and call those functions within your React components
Tip We've left an example of consuming an API for you - you may wish to use this as a template. The example uses this amiibo API: https://amiiboapi.com/docs/

API Suggestions

If you're not sure where to start, you can use one of the APIs listed below.

Browser friendly APIs (no API key required or CORS restrictions)

API Collections https://github.com/marcelscruz/public-apis: this is a big list of APIs across a lot of different topics, so remember to keep things work-appropriate and friendly
Because we're doing everything in the browser, we want an API that:

- _does not_ require an API key
- _does_ support https
- _does_ support CORS

If any of the examples in this list are out of date, please let your facilitators know and create a Pull Request on this repo!

Provide feedback on this repo

About

very basic webpage to display where the International Space Station is, updates each second

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published