diff --git a/README.md b/README.md index 9abcbf2..d056623 100644 --- a/README.md +++ b/README.md @@ -1 +1,88 @@ -# rxjs-probe \ No newline at end of file +
+

✨ rxjs-probe ✨

+ +

+ + Documentation + + + Documentation + + + Documentation + + + Maintenance + + + License: MIT + +

+
+ +> rxjs-probe provides an interface similar to Kubernetes probes using RxJS to detect service health. + +## 🔗 Link + +- [Github](https://github.com/a179346/rxjs-probe) +- [npm](https://www.npmjs.com/package/@rxjs-probe/core) + +## 📥 Install + +```sh +npm i rxjs @rxjs-probe/core +``` + +## 🔑 Usage + +```ts +import { Probe, ProbePerformer } from '@rxjs-probe/core'; +import axios from 'axios'; + +const probe = new Probe({ + performer: new ProbePerformer(async timeoutSeconds => { + await axios({ + url: 'https://github.com/a179346/rxjs-probe', + timeout: timeoutSeconds * 1000, + validateStatus: status => status === 200, + }); + }), + initialDelaySeconds: 3, + periodSeconds: 2, + timeoutSeconds: 1, + successThreshold: 1, + failureThreshold: 3, +}); + +const probeObservable = probe.createObservable(); +``` + +probeObservable is an RxJS Observable. You can subscribe to it to get the probe status. + +Check the [RxJS documentation - Observable](https://rxjs.dev/guide/observable) for more information. + +## 📖 Examples + +You can find more examples on how to use rxjs-probe in [rxjs-probe-examples GitHub repository](https://github.com/a179346/rxjs-probe-examples). + +## 🔎 Probe Performers + +- [Probe Performer](https://github.com/a179346/rxjs-probe-examples/tree/main?tab=readme-ov-file#-custom-probe-performer) - The customizable health check performer +- [Http Probe Performer](https://github.com/a179346/rxjs-probe/tree/main/packages/http-probe-performer#readme) - send HTTP GET requests to perform the health check. + +## 🤝 Contributing + +Contributions, issues and feature requests are welcome!
Feel free to check [issues page](https://github.com/a179346/rxjs-probe/issues). + +## 🌟 Show your support + +Give a ⭐️ if this project helped you! + +## 📝 License + +Copyright © 2024 [a179346](https://github.com/a179346).
+This project is [MIT](https://github.com/a179346/rxjs-probe/blob/main/LICENSE) licensed. + +--- + +_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_ diff --git a/packages/core/README.md b/packages/core/README.md index 705ae8e..d056623 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -1,11 +1,88 @@ -# `@rxjs-probe/core` +
+

✨ rxjs-probe ✨

-> TODO: description +

+ + Documentation + + + Documentation + + + Documentation + + + Maintenance + + + License: MIT + +

+
-## Usage +> rxjs-probe provides an interface similar to Kubernetes probes using RxJS to detect service health. +## 🔗 Link + +- [Github](https://github.com/a179346/rxjs-probe) +- [npm](https://www.npmjs.com/package/@rxjs-probe/core) + +## 📥 Install + +```sh +npm i rxjs @rxjs-probe/core ``` -const core = require('@rxjs-probe/core'); -// TODO: DEMONSTRATE API +## 🔑 Usage + +```ts +import { Probe, ProbePerformer } from '@rxjs-probe/core'; +import axios from 'axios'; + +const probe = new Probe({ + performer: new ProbePerformer(async timeoutSeconds => { + await axios({ + url: 'https://github.com/a179346/rxjs-probe', + timeout: timeoutSeconds * 1000, + validateStatus: status => status === 200, + }); + }), + initialDelaySeconds: 3, + periodSeconds: 2, + timeoutSeconds: 1, + successThreshold: 1, + failureThreshold: 3, +}); + +const probeObservable = probe.createObservable(); ``` + +probeObservable is an RxJS Observable. You can subscribe to it to get the probe status. + +Check the [RxJS documentation - Observable](https://rxjs.dev/guide/observable) for more information. + +## 📖 Examples + +You can find more examples on how to use rxjs-probe in [rxjs-probe-examples GitHub repository](https://github.com/a179346/rxjs-probe-examples). + +## 🔎 Probe Performers + +- [Probe Performer](https://github.com/a179346/rxjs-probe-examples/tree/main?tab=readme-ov-file#-custom-probe-performer) - The customizable health check performer +- [Http Probe Performer](https://github.com/a179346/rxjs-probe/tree/main/packages/http-probe-performer#readme) - send HTTP GET requests to perform the health check. + +## 🤝 Contributing + +Contributions, issues and feature requests are welcome!
Feel free to check [issues page](https://github.com/a179346/rxjs-probe/issues). + +## 🌟 Show your support + +Give a ⭐️ if this project helped you! + +## 📝 License + +Copyright © 2024 [a179346](https://github.com/a179346).
+This project is [MIT](https://github.com/a179346/rxjs-probe/blob/main/LICENSE) licensed. + +--- + +_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_ diff --git a/packages/http-probe-performer/README.md b/packages/http-probe-performer/README.md index ad6c1fe..0c04136 100644 --- a/packages/http-probe-performer/README.md +++ b/packages/http-probe-performer/README.md @@ -1,11 +1,70 @@ -# `@rxjs-probe/http-probe-performer` +
+

✨ rxjs-probe http-probe-performer ✨

-> TODO: description +

+ + Documentation + + + Documentation + + + Documentation + + + Maintenance + + + License: MIT + +

+
-## Usage +> The probe performer that send HTTP GET requests to perform the health check. +## 🔗 Link + +- [Github](https://github.com/a179346/rxjs-probe) +- [npm](https://www.npmjs.com/package/@rxjs-probe/http-probe-performer) + +## 📥 Install + +```sh +npm i @rxjs-probe/core @rxjs-probe/http-probe-performer ``` -const httpProbePerformer = require('@rxjs-probe/http-probe-performer'); -// TODO: DEMONSTRATE API +## 🔑 Usage + +```ts +import { HttpProbePerformer } from '@rxjs-probe/http-probe-performer'; + +const probePerformer = new HttpProbePerformer({ + host: 'github.com', + path: '/a179346/rxjs-probe', + scheme: 'HTTPS', +}); ``` + +Probe performer should be used with the Probe from [@rxjs-probe/core](https://github.com/a179346/rxjs-probe/tree/main/packages/core) package. + +## 🔎 Probe Performers + +- [Probe Performer](https://github.com/a179346/rxjs-probe-examples/tree/main?tab=readme-ov-file#-custom-probe-performer) - The customizable health check performer +- [Http Probe Performer](https://github.com/a179346/rxjs-probe/tree/main/packages/http-probe-performer#readme) - send HTTP GET requests to perform the health check. + +## 🤝 Contributing + +Contributions, issues and feature requests are welcome!
Feel free to check [issues page](https://github.com/a179346/rxjs-probe/issues). + +## 🌟 Show your support + +Give a ⭐️ if this project helped you! + +## 📝 License + +Copyright © 2024 [a179346](https://github.com/a179346).
+This project is [MIT](https://github.com/a179346/rxjs-probe/blob/main/LICENSE) licensed. + +--- + +_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_