All Projects → webscopeio → react-health-check

webscopeio / react-health-check

Licence: MIT license
Lightweight React hook for checking health of API services.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-health-check

nestjs-redis
Redis(ioredis) module for NestJS framework
Stars: ✭ 112 (+300%)
Mutual labels:  health, check
use-scroll-direction
A simple, performant, and cross-browser hook for detecting scroll direction in your next react app.
Stars: ✭ 24 (-14.29%)
Mutual labels:  hook, detect
Sol Journal
✎ Simple, personal journaling progressive web app
Stars: ✭ 470 (+1578.57%)
Mutual labels:  offline, health
es-feature-detection
ECMAScript feature and API detection
Stars: ✭ 16 (-42.86%)
Mutual labels:  detect, check
connection checker
Android library for checking the internet connectivity of a device.
Stars: ✭ 26 (-7.14%)
Mutual labels:  detect, check
kirby3-doctor
Plugin to check health of your CMS installation
Stars: ✭ 19 (-32.14%)
Mutual labels:  health, check
angular-http-cache
Speed up your remote requests by automatically caching them on client and add support for offline navigation.
Stars: ✭ 25 (-10.71%)
Mutual labels:  offline
hookey
Enables all the DLCs. Like Creamapi but just for linux and a subset of Paradox games.
Stars: ✭ 87 (+210.71%)
Mutual labels:  hook
react-use-hotkeys
React hook for creating simple keyboard shortcuts
Stars: ✭ 74 (+164.29%)
Mutual labels:  hook
learncpp-download
Scrape bot, to get you an offline copy of tutorials
Stars: ✭ 23 (-17.86%)
Mutual labels:  offline
ts4health
Time Series Data Analysis, Visualization and Forecasting with Python for Health and Self
Stars: ✭ 17 (-39.29%)
Mutual labels:  health
letsencrypt-manual-hook
Allows you to use dehydrated (a Let's Encrypt/Acme Client) and DNS challenge response with a DNS provider that requires manual intervention
Stars: ✭ 61 (+117.86%)
Mutual labels:  hook
generator-sf
Yeoman generator that scaffolds out a Symfony PHP app including Browsersync, various CSS preprocessors, jspm, webpack, browserify and Service Worker
Stars: ✭ 14 (-50%)
Mutual labels:  offline
PanFLUte
An open source spirometer for everyone.
Stars: ✭ 14 (-50%)
Mutual labels:  health
furniture
The furniture R package contains table1 for publication-ready simple and stratified descriptive statistics, tableC for publication-ready correlation matrixes, and other tables #rstats
Stars: ✭ 43 (+53.57%)
Mutual labels:  health
Smart-Text-Editor
The text editor that requires only a browser and a keyboard!
Stars: ✭ 60 (+114.29%)
Mutual labels:  offline
webtorrent-health
💚 Get health info about a webtorrent file or magnet link
Stars: ✭ 27 (-3.57%)
Mutual labels:  health
logrus-redis-hook
Hook for Logrus which enables logging to RELK stack (Redis, Elasticsearch, Logstash and Kibana)
Stars: ✭ 33 (+17.86%)
Mutual labels:  hook
semantic-commit-hook
Git hook that enforces semantic commit messages.
Stars: ✭ 34 (+21.43%)
Mutual labels:  hook
organicmaps
🍃 Organic Maps is a free Android & iOS offline maps app for travelers, tourists, hikers, and cyclists. It uses crowd-sourced OpenStreetMap data and is developed with love by MapsWithMe (MapsMe) founders and our community. No ads, no tracking, no data collection, no crapware. Your donations and positive reviews motivate and inspire our small team!
Stars: ✭ 3,689 (+13075%)
Mutual labels:  offline

React Health Check 🏥

Lightweight React hook for checking health of API services.

stable tslib checks license


Installation 🧑‍🔧

npm i @webscopeio/react-health-check

or

yarn add @webscopeio/react-health-check

Examples 😲

Usage

const { available, refresh } = useHealthCheck({
  service: {
    name: 'auth',
    url: 'https://example.com/auth/health',
  },
  onSuccess: ({ service, timestamp }) => {
    console.log(`Service "${service.name}" is available since "${timestamp}" 🎉`);
  },
  onError: ({ service, timestamp }) => {
    console.log(`Service "${service.name}" is not available since "${timestamp}" 😔`);
  },
});

You can also create a global configuration so you don't have to define services and callbacks every time:

// App wrapper
<HealthCheckConfig
  value={{
    services: [
      {
        name: 'auth',
        url: 'https://example.com/auth/health',
      },
      {
        name: 'payment',
        url: 'https://example.com/payment/health',
      },
    ],
    onSuccess: ({ service, timestamp }) => {
      console.log(`Service "${service.name}" is available since "${timestamp}" 🎉`);
    },
    onError: ({ service, timestamp }) => {
      console.log(`Service "${service.name}" is not available since "${timestamp}" 😔`);
    },
  }}
>
  <App />
</HealthCheckConfig>;

// Later in some child component
const { available } = useHealthCheck('auth');

Configuration 🛠

useHealthCheck() hook accepts a configuration object with keys:

Key Type Description
service Service<S = string> Object defining an API service to be checked.
onSuccess (state: ServiceState<S>) => void; Callback which should be called when API service becomes available again.
onError (state: ServiceState<S>) => void; Callback which should be called when API service becomes unavailable.
refreshInterval number Polling interval for health checks in milliseconds.
Default value: 5000
refreshWhileHidden boolean Determines whether polling should be paused while browser window isn't visible.
Default value: false

Global configuration accepts the same keys as useHealthCheck() hook with the exception of "service". You need to specify array of "services" when using global configuration.

License 💼

MIT | Developed by Webscope.io

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].