fastify-invincible

0.1.0 • Public • Published

fastify-invincible

JavaScript Style Guide ci

An hacky plugin to integrate betterstack.com and keep your Fastify application up and running.

Install

npm install fastify-invincible

Compatibility

Plugin version Fastify version
^0.1.0 ^4.0.0

Usage

This plugin is a raw integration with betterstack.com. It will create a new monitor for your application during the startup phase.

If a monitor with the same name already exists, it will be skipped.

Note that this plugin is an early stage POC, so it may change in the future.

const fastifyInvincible = require('fastify-invincible')
const app = require('fastify')({ logger: true })

app.head('/foo-bar', (req, reply) => {
  reply.send('ok')
})

const appUrl = 'https://example.com'
app.register(fastifyInvincible, {
  name: 'My app',
  pollingUrl: appUrl + '/foo-bar',
  pollingIntervalSeconds: 300,
  betterstackOptions: {
    key: 'your-api-key',
    uniqueUrl: true, // if you set it to false, the plugin will add a new monitor at every restart
    createMonitorPayload: {
      // customize all the payload fields as you want adding the ones you need:
      // https://betterstack.com/docs/uptime/api/create-a-new-monitor/
      http_method: 'HEAD',
    }
  }
})

app.listen({ port: 8080 })

License

Copyright Manuel Spigolon, Licensed under MIT.

Package Sidebar

Install

npm i fastify-invincible

Weekly Downloads

6

Version

0.1.0

License

MIT

Unpacked Size

9.02 kB

Total Files

11

Last publish

Collaborators

  • eomm