Nonstop Perpetual Motion
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    connect-settimeoutpublic

    connect-settimeout

    a connect middleware that runs a provided function if a request lasts longer than a given duration

    Build Status Coverage Status

    NPM

    Setup:

    Add this middleware to your connect or express app like this:

    var connectSetTimeout = require('connect-settimeout');
    app.use(connectSetTimeout(function(req, res){
      // do whatever you want with the slow request, eg:
      console.error("There was a slow response at ", req.method, req.url);
    }, 10000));  // 10 seconds, specified in milliseconds

    install

    npm i connect-settimeout

    Downloadsweekly downloads

    48

    version

    0.0.3

    license

    MIT

    repository

    githubgithub

    last publish

    collaborators

    • avatar
    • avatar