{"id":18926770,"url":"https://github.com/ladjs/koa-better-timeout","last_synced_at":"2025-04-15T13:33:19.353Z","repository":{"id":66193108,"uuid":"102979872","full_name":"ladjs/koa-better-timeout","owner":"ladjs","description":"Response timeout middleware for Koa and Lad (uses Boom by default)","archived":false,"fork":false,"pushed_at":"2020-07-23T01:53:29.000Z","size":311,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-02T12:01:42.633Z","etag":null,"topics":["api","koa","lad","middleware","ms","response","settimeout","time","timeout","timer"],"latest_commit_sha":null,"homepage":"https://lad.js.org","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ladjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-09T19:29:09.000Z","updated_at":"2020-07-23T01:53:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"0ab9b262-a84c-4686-b4a6-b46de0576721","html_url":"https://github.com/ladjs/koa-better-timeout","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladjs%2Fkoa-better-timeout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladjs%2Fkoa-better-timeout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladjs%2Fkoa-better-timeout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladjs%2Fkoa-better-timeout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ladjs","download_url":"https://codeload.github.com/ladjs/koa-better-timeout/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249080477,"owners_count":21209534,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","koa","lad","middleware","ms","response","settimeout","time","timeout","timer"],"created_at":"2024-11-08T11:17:07.403Z","updated_at":"2025-04-15T13:33:19.060Z","avatar_url":"https://github.com/ladjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# koa-better-timeout\n\n[![build status](https://img.shields.io/travis/ladjs/koa-better-timeout.svg)](https://travis-ci.org/ladjs/koa-better-timeout)\n[![code coverage](https://img.shields.io/codecov/c/github/ladjs/koa-better-timeout.svg)](https://codecov.io/gh/ladjs/koa-better-timeout)\n[![code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)\n[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![made with lass](https://img.shields.io/badge/made_with-lass-95CC28.svg)](https://lass.js.org)\n[![license](https://img.shields.io/github/license/ladjs/koa-better-timeout.svg)](\u003c\u003e)\n\n\u003e Response timeout middleware for [Koa][] and [Lad][] (uses [Boom][] by default)\n\n\n## Table of Contents\n\n* [Install](#install)\n* [Usage](#usage)\n* [Options](#options)\n* [Contributors](#contributors)\n* [License](#license)\n\n\n## Install\n\n[npm][]:\n\n```sh\nnpm install koa-better-timeout\n```\n\n[yarn][]:\n\n```sh\nyarn add koa-better-timeout\n```\n\n\n## Usage\n\n\u003e Default middleware usage:\n\n```js\nconst Timeout = require('koa-better-timeout');\n\n// ...\n\nconst timeout = new Timeout();\napp.use(timeout.middleware);\n```\n\n\u003e Advanced middleware usage (e.g. using [Lad][] and its [@ladjs/i18n][ladjs-i18n] middleware) with translated response message:\n\n```js\nconst Timeout = require('koa-better-timeout');\n\n// ...\n\nconst timeout = new Timeout({\n  message: ctx =\u003e ctx.translate('REQUEST_TIMED_OUT')\n});\napp.use(timeout.middleware);\n```\n\n\n## Options\n\nYou can optionally pass an object of options to `Timeout(opts)`.\n\nThe default option values use [Boom][] and are:\n\n```js\n{\n  ms: 6000,\n  message: Boom.clientTimeout().message,\n  sendResponse: Boom.clientTimeout\n}\n```\n\nNote that `message` can be a function that accepts one argument `ctx`.  This is useful if you wish to use i18n translation for the response message.\n\n\n## Contributors\n\n| Name           | Website                    |\n| -------------- | -------------------------- |\n| **Nick Baugh** | \u003chttp://niftylettuce.com/\u003e |\n\n\n## License\n\n[MIT](LICENSE) © [Nick Baugh](http://niftylettuce.com/)\n\n\n## \n\n[npm]: https://www.npmjs.com/\n\n[yarn]: https://yarnpkg.com/\n\n[lad]: https://lad.js.org\n\n[boom]: https://github.com/hapijs/boom\n\n[ladjs-i18n]: https://github.com/ladjs/i18n\n\n[koa]: http://koajs.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fladjs%2Fkoa-better-timeout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fladjs%2Fkoa-better-timeout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fladjs%2Fkoa-better-timeout/lists"}