Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Status Page #1

Open
michaelrambeau opened this issue Aug 14, 2018 · 1 comment
Open

API Status Page #1

michaelrambeau opened this issue Aug 14, 2018 · 1 comment
Assignees

Comments

@michaelrambeau
Copy link
Member

michaelrambeau commented Aug 14, 2018

This issue is a discussion about the requirements of the first page we'd like to implement: the API status page.

Goal

Create a page to monitor the status of all the APIs we connect in Best of JavaScript, and especially the API we created.

We want to know:

  • if the API is online (does it respond with a 200 status)
  • how much time it takes to respond
  • how much data it returns (the size)

We'd like to check the JSON content returned by the API end-point.

In this first iteration, no backend is required, it would be a "real time check" every time the user opens the page.

How it could look like

The page could display several cards, every card would show the status of a given end-point.

The card would display:

  • The status online / error
  • The response time
  • The size of data returned
  • Data returned by the payload (maybe inside an expandable section, collapsed by default):
    • Raw data (JSON or HTML)
    • Formatted Data (JSON with syntax highlighted or HTML preview)

There would be a way to refresh data for any card.

We could use a timer to refresh data after every seconds.

Optional: the card could store in its local state the history of every request, so that we compare the results of the last N requests triggered since the page was opened.

Components

We could use a stateful component <FetchStatus> to fetch data about the status for a given URL , using the "render prop" pattern.

<FetchStatus url="https://bestofjs-api-v2.now.sh/projects/reduxjs/redux">
  ({ data, responseTime, responseSize, isLoading }) => <div />
</FetchStatus>

It could use, under the hood, this component: https://github.com/ghengeveld/react-async that has interesting features:

  • startedAt and finishedAt dates (useful to compute the response time)
  • cancel and reload action

To render the status of a given API end-point, we could create stateful <Status /> component

<Status
 url="https://bestofjs-api-v2.now.sh/projects/reduxjs/redux"
 httpStatus={200}
 responseTime={1248}
 responseSize={145}
 data={{ "name": "Redux" }}
/>

API URLs

Most of the URLs return JSON data, except get-github-readme-v2 URL that returns HTML.

@michaelrambeau
Copy link
Member Author

Inspiration for the UI

ChecklyHQ

https://checklyhq.com/

A better way to monitor your API's and site click flows
Seamlessly monitor the performance and correctness of your API endpoints and vital site transactions from a single dashboard."

image

Insomnia

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants