express-watcher
It is a middleware of monitoring Express router, this middleware can be used either globally or on a per-route basis and sends information of response time, used memory and CPU.
![NPM](https://nodei.co/npm/express-watcher.png?downloads=true&downloadRank=true)
![jun-30-2017 23-02-52](https://user-images.githubusercontent.com/5538753/27741661-6eb37570-5de8-11e7-8d49-570251ee118d.gif)
Install
$ npm install --save express-watcher
Usage
var resourceMonitorMiddleware = require('express-watcher').resourceMonitorMiddleware
app.use(resourceMonitorMiddleware)
Using with Callback
var resourceMonitorMiddlewareCB = require('express-watcher').resourceMonitorMiddlewareCB
app.use(function(req, res, next){
resourceMonitorMiddlewareCB(req, res, next, function(diffJson){
console.log(' diffJson : ', diffJson)
})
})
Functionality
1- Monitoring each response
Return object as a callback:
{ diffRss: 0.0078125,
diffHeapTotal: 0,
diffHeapUsed: 0.012725830078125,
diffExternal: 0,
diffCpu: 0.000427 }
And auto print:
![image](https://user-images.githubusercontent.com/5538753/27582174-97f9d326-5b62-11e7-9cd4-862eb4f897cb.png)
2- Monitoring all time high information
All time high information is printed when closing (CRT+c) the node process
And auto print:
![image](https://user-images.githubusercontent.com/5538753/27582293-00daced6-5b63-11e7-8d39-149177159f1d.png)
Reference
License
MIT