Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eomm/fastify-invincible
An hacky plugin to integrate betterstack.com and keep your Fastify application up and running
https://github.com/eomm/fastify-invincible
betterstack fastify fastify-plugin monitoring polling
Last synced: 11 days ago
JSON representation
An hacky plugin to integrate betterstack.com and keep your Fastify application up and running
- Host: GitHub
- URL: https://github.com/eomm/fastify-invincible
- Owner: Eomm
- License: mit
- Created: 2023-09-09T08:04:29.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-04T23:37:37.000Z (10 months ago)
- Last Synced: 2024-10-20T10:53:50.673Z (2 months ago)
- Topics: betterstack, fastify, fastify-plugin, monitoring, polling
- Language: JavaScript
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fastify-invincible
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![ci](https://github.com/Eomm/fastify-invincible/actions/workflows/ci.yml/badge.svg)](https://github.com/Eomm/fastify-invincible/actions/workflows/ci.yml)An hacky plugin to integrate [betterstack.com](https://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](https://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.
```js
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](https://github.com/Eomm), Licensed under [MIT](./LICENSE).