Skip to content

A Express middleware for tracking request and responses.

License

Notifications You must be signed in to change notification settings

tjeeay/express-req-tracker

Repository files navigation

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

About

A Express middleware for tracking request and responses.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published