fh-express-stats
Express Middleware to provide application statistics via the Statistics Tab in the FeedHenry Studio.
What do I get?
The following statistics will be added to the Statistics tab for your Cloud App automaitcally when using this module:
Counters
- Calls to route: [ROUTE]
- Open Requests
- Requests Served
- Requests Received
- Requests with Errors
"Calls to route" will show the baseUrl and any subroutes independently.
Timers
Response Time for [ROUTE]
Usage
Install with NPM:
$ npm i fh-express-stats --save
Add to FeedHenry Express application. The fh-mbaas-api dependency must be installed in your project to use this.
var mbaasApi = ;var express = ;var mbaasExpress = mbaasApi;var fhStats = ;var cors = ; var app = ; // Note: the order which we add middleware to Express here is important!app;app; // Note: important that this is added just before your own Routesapp; // Stats middleware can go hereapp; // fhlint-begin: custom-routesapp;// fhlint-end // Important that this is last!app; var port = processenvFH_PORT || processenvVCAP_APP_PORT || 8001;var server = app;
Contributing
Add any new statistics you think would be useful!
Simply run npm test to run tests from the root directory.
Stubs are used for testing, take a look at the test file and it should be clear how they work.