Express Monitoring
Package allows to define custom monitoring controls (rules) and execute them using express handlers.
This NodeJS adaptation of Horat1us/yii2-monitoring package for PHP.
Written on Typescript.
Installation
Using NPM:
npm i express-monitoring
Documentation
Structure
- Controller - controller with express request handlers
- Control - interface for monitoring control items.
- Compose - pre-defined control to compose another controls.
- Dependency - pre-defined control to block execution of another control.
- FailureError - error class to be thrown in controls.
Usage
You need to define your own Control or use one of pre-defined. Then, just create Controller instance and add it to routes.
// region Monitoring Controller Definition// This should be placed to separate file; // can also be async or return promise; ;;// endregion ; ;; app.get'/monitoring/:id', Monitoring.control; // route to check controls separatelyapp.get'/monitoring/full', Monitoring.full; // route to check all controls by one request app.listen3000,`Monitoring app listening on port `;
Then you can make request GET http://localhost:3000/monitoring/controlID
.
For response examples see Documentation.