express-req-tracker
v1.3.0
Published
A Express middleware for tracking request and responses.
Downloads
95
Readme
express-req-tracker
A Express middleware for tracking request and responses.
Installation
yarn add express-req-tracker
# or
npm install -S express-req-tracker
Usage
import express from 'express';
import reqTracker from 'express-req-tracker';
const app = express();
// use req-tracker
app.use(reqTracker({
app: 'my-project',
mongodb: 'mongodb://localhost/req-tracker-sample',
options: {
immediate: true
}
}));
app.get('/', (req, res) => {
res.json('hello world');
});
const PORT = process.env.PORT;
app.listen(PORT, () => {
console.log(`server is running at: http://localhost:${PORT}`);
});
Run Example
Notice
: before run example, please ensure you have installed and running MongoDB.
# first: run unit test to produce request logs
npm run test
# second: run sample
npm run start
after running example, then you can open the dashboard http://localhost:7001/req-tracker/dashboard to view the request logs.
License
MIT