{"library":"timeout-middleware","type":"library","category":null,"description":"This package, `timeout-middleware` (current version 0.6.1), provides an Express.js middleware designed to gracefully handle slow requests by enforcing a response timeout. It intercepts `res.status`, `res.sendStatus`, and `res.send` methods, checking a `res.timedout` flag before allowing further modifications to the response. Upon timeout, if headers have not yet been sent, it automatically sets the response status to 503 (Service Unavailable) and sends a 'Request Timeout' message. This approach differs from alternatives like `connect-timeout` which require manual `haltOnTimedout` checks after every middleware in the chain. The library aims for a more 'DRY' (Don't Repeat Yourself) implementation by wrapping the core response methods, preventing accidental operations on a timed-out request. As a pre-1.0 version, future API changes are possible, and its release cadence is not explicitly defined in the provided information.","language":"javascript","status":"active","version":"0.6.1","tags":["javascript","node","express","timeout","request"],"last_verified":"Wed May 27","install":[{"cmd":"npm install timeout-middleware","imports":["import timeout from 'timeout-middleware';","import timeout from 'timeout-middleware';\napp.use(timeout(30000));"]},{"cmd":"yarn add timeout-middleware","imports":[]},{"cmd":"pnpm add timeout-middleware","imports":[]}],"homepage":null,"github":"https://github.com/fjodorekstrom/timeout-middleware","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/timeout-middleware","openapi_spec":null,"status_page":null,"smithery":null,"compatibility":{"summary":{"python_range":"18–22","success_rate":0,"avg_install_s":null,"avg_import_s":null,"wheel_type":null},"url":"https://checklist.day/v1/registry/timeout-middleware/compatibility"}}