express-watcher
is a middleware of monitoring Express router, it helps to observe information of Response Time, RAM, heap memory and CPU.
During the time of developing Isomorphic Application(React-Redux-ServerRendering), tracking the issue of performance become harder and harder, because performance could be affected by many factors : — Express server performance — API — Component Design(React) — Algorithm — Browser performance
It is a tool that helps me find out performance issue during development stage(NOT PRODUCTION!!!).
$ npm install --save express-watcher
To print every request
var resourceMonitorMiddleware = require('express-watcher').resourceMonitorMiddleware
// example without callback function
app.use(resourceMonitorMiddleware)
To get monitoring data from every request
var resourceMonitorMiddlewareCB = require('express-watcher').resourceMonitorMiddlewareCB
// example with callback function
app.use(function(req, res, next){
resourceMonitorMiddlewareCB(req, res, next, function(diffJson){console.log(' diffJson : ', diffJson)})})
Return object as a callback:
{ diffRss: 0.0078125, diffHeapTotal: 0, diffHeapUsed: 0.012725830078125, diffExternal: 0, diffCpu: 0.000427 }
And auto print:
All time high information is printed when closing (CRT+c) the node process
And auto print: