timeout-request
v1.8.0
Published
http timeout request middleware
Downloads
935
Readme
timeout-request
Set the number of milliseconds that a script is allowed to run in nodejs.
If this timeout is reached, res.end()
or custom callback will be called
Installation
Install through NPM
npm install timeout-request
or
git clone git://github.com/hex7c0/timeout-request.git
API
inside expressjs project
var timeout = require('timeout-request');
var app = require('express')();
app.use(timeout());
timeout(options)
options
milliseconds
- Number Number of milliseconds before callback (default "5000")header
- Boolean If enabled, checkres._header
before callback (default "false")data
- Object Object passed to custom callback afterreq
andres
(default "null")callback
- Function Custom callback instead ofres.end
(default "null")
Examples
Take a look at my examples