tn-route-traffics
TypeScript icon, indicating that this package has built-in type declarations

2.1.2 • Public • Published

Middleware

app.use(
  routeTrafficsMiddleware({
    concurrency: 6,
    maxQueue: 10000,
    unlockTimeout: '1m',
    forceCloseTimeout: '10m',
    excludes: ['/status'],
    bypass: ['/bypass'],
    bypassSecret: '**********',
    logDump: dump => {...},
    logDumpInterval: '1m',
    logDumpExtras: {
      base: () => ({}),
      pressure: () => ({}),
      visit: req => ({ user: req.user || null })
    },
  })
)

Status

$routeTraffic.status.getStatus()

How Bypass Header Work

  • Set bypassSecret in opts
  • Create bypass headers using routeTrafficsBypassHeaders()
  • It will generate a header object like { trafficbypass: "***" }
  • Requests with these headers will be bypass the queue

Readme

Keywords

none

Package Sidebar

Install

npm i tn-route-traffics

Weekly Downloads

1

Version

2.1.2

License

MIT

Unpacked Size

48.9 kB

Total Files

61

Last publish

Collaborators

  • turnova