e-statics

Express request statics counter

Usage no npm install needed!

<script type="module">
  import eStatics from 'https://cdn.skypack.dev/e-statics';
</script>

README

e-statics

NPM Version NPM Downloads

Module for express statics, returns

{
"GET": 0,
"POST": 0,
"PUT": 0,
"DELETE": 0,
"TOTAL": 0,
"LAST_MS": 0,
"AVG_MS": 0,
"MIN_MS": 0,
"MAX_MS": 0,
"TOTAL_MS": 0
}

Installation

npm install e-statics --save

Usage

e-statics adds automatically get route(/e-statics) to your routes.


const express = require("express");
const app = express();
const eStatics = require("e-statics")(app);
app.use(eStatics.counter);
app.get('/', (req, res) => res.send('Hello World!'))
app.listen(8080, () => console.log(`Example app listening on port ${port}!`))

If you dont want to use this route just dont add app to e-statics


const express = require("express");
const app = express();
const eStatics = require("e-statics")();
app.use(eStatics.counter);
app.get('/', (req, res) => res.send('Hello World!'))
app.get('/my-stats-route', (req, res) => res.send(eStatics.stats))
app.listen(8080, () => console.log(`Example app listening on port ${port}!`))