Ligtweight middleware to collect statistics for your nodejs rest api calls
npm install apistats
//Require apistats
var app = require('express')();
var apistats = require('apistats');
//Initialize apistats module
var apistats_options = {
filepath : './apistats.json', //required: this is where all the statistics will be stored
interval : 15 //interval in minutes when the file gets updated. Default is 15 mins
}
apistats.init(apistats_options)
//Include apistats in all API calls
app.all('*',apistats.map)
Count the number of times an API is invoked taking path and query parameters into account
Express > 2.x
Mean execution time : 0.762ms (50 runs) Min execution time : 0.321ms Max execution time : 3.323ms API stats will add 0.762ms on an average to every API call whose analytics you want to collect
constant * O(n) where n = number of API calls to be analyzed and the constant depends on the size in bytes for the APIs
Minimal