express-req-tracker

1.3.0 • Public • Published

express-req-tracker

Travis-CI NPM downloads

NPM package-info

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

Readme

Keywords

Package Sidebar

Install

npm i express-req-tracker

Weekly Downloads

2

Version

1.3.0

License

MIT

Last publish

Collaborators

  • tjeeay