npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@chreeio/fastify-status

v1.5.1

Published

Fastify plugin exposing overall server status (including version and health).

Downloads

32

Readme

fastify-status

Build Master status npm version LICENCE

Fastify plugin exposing overall server status: version, health and custom data.

Installation

npm i @chreeio/fastify-status

Features

  • HTTP endpoint serving overall health, custom health checks, version and custom properties.
  • Three-valued (ok, degraded, failing) overall health calculated from custom health checks.
  • Health checks can execute scheduled or on-demand when service status is requested via HTTP.
  • Customizable Fastify onRequest hook executed when the overall health is failing.

Usage

Simply import the plugin and register it:

import fastify from 'fastify'
import fastifyStatus from '@chreeio/fastify-status'

const app = fastify()

app.register(fastifyStatus, {
  route: {
    expose: true,
  },
})

Please take a look at the test folder for more involved examples.

Options

When registering fastify-status, you can set the following options. Please note, that each setting is optional.

| Option | Descripton | |----------|-------------| | route.expose | Whether to expose an HTTP endpoint serving status information or not. Set to false by default. | | route.path | The path of the HTTP status endpoint. Set to /status by default. | | route.customOptions | Additional customization for the HTTP status endpoint. Please refer to https://www.fastify.io/docs/latest/Routes/#routes-option regarding the permitted HTTP route options. | | health.updateInterval | The interval between subsequent health checks in milliseconds. If not set, then health checks will be performed on each request to the exposed status endpoint. By default, this setting is not set. | | health.checks | An arbitrary number of custom health checks. If an update interval is set, then these checks will be scheduled. Otherwise, they are executed on each request to the status endpoint. | | health.overallStatusCalculator | A function calculating the overall health of the service using the values provided by the checks. By default, this function sets the overall health to failing if there's a failing check and degraded if there's a degraded check. | | failingStatusRequestHook | A Fastify onRequest hook (https://www.fastify.io/docs/latest/Hooks/#onrequest) which is executed on each request if the current overall health of the service is failing. Note, that this hook is only registered if there's an update interval set for the health checks. By default, this hook will return 503 - Service Unavailable to every request. | | version | A string to string mapping of version information. | | customProperties | Any additional custom properties. These are going to be appended to the response of the status endpoint. |

Acknowledgements

This is an open source project maintained by Chree. For more projects maintained or supported by Chree, please head over to the Chree Open Source page.

Licence

This package is licensed under MIT.