Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

debug-middleware

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

debug-middleware

Cause express middleware to time out and report failures.

  • 1.0.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-88.89%
Maintainers
1
Weekly downloads
 
Created
Source

node-debug-middleware

Build Status

npm install debug-middleware

Log middleware that does not complete within an allotted amount of time

Usage

debug(app, [timeout])

Arguments

  • app - an express app
  • timeout (optional) Number - Milliseconds to wait for request handlers and middleware to complete. Defaults to 5000.

Call the middleware debugger after all of your middleware and routes have been defined.

var express         = require('express');
var app             = express();
var debugMiddleware = require('debug-middleware');

function slowMiddleware(req, res, next) {
  setTimeout(function() {
    next();
  }, 6000);
}

app.get('/', slowMiddleware, function(req, res, next) {
  res.send('ok');
});

app.on('listening', function() {
  debugMiddleware.debug(app);
});

Output

The following items will be included in the log output:

  • The request method
  • The request host
  • The request path
  • The middleware function as a one-line string

Example output:

A route middleware took too long to execute:  example.com/some/path?this=that function slowMiddleware(req, res, next) {\n  setTimeout(function() {\n    next();\n  }, 6000);\n}

FAQs

Package last updated on 06 Feb 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc