🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

fh-express-stats

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fh-express-stats

Adds out of the box statistics to a FeedHenry Cloud App

latest
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

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 = require('fh-mbaas-api');
var express = require('express');
var mbaasExpress = mbaasApi.mbaasExpress();
var fhStats = require('fh-express-stats');
var cors = require('cors');

var app = express();

// Note: the order which we add middleware to Express here is important!
app.use('/sys', mbaasExpress.sys(securableEndpoints));
app.use('/mbaas', mbaasExpress.mbaas);

// Note: important that this is added just before your own Routes
app.use(mbaasExpress.fhmiddleware());

// Stats middleware can go here
app.use(fhStats(mbaasApi));

// fhlint-begin: custom-routes
app.use('/hello', require('./lib/hello.js')());
// fhlint-end

// Important that this is last!
app.use(mbaasExpress.errorHandler());

var port = process.env.FH_PORT || process.env.VCAP_APP_PORT || 8001;
var server = app.listen(port, function() {
  console.log("App started at: " + new Date() + " on port: " + port);
});

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.

Keywords

fh

FAQs

Package last updated on 24 Nov 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts