{"id":20624770,"url":"https://github.com/yss/koa-api-combo","last_synced_at":"2026-05-09T19:31:17.115Z","repository":{"id":57149037,"uuid":"94388993","full_name":"yss/koa-api-combo","owner":"yss","description":"proxy multiple http or https requests, and response the result array by combine all the result.","archived":false,"fork":false,"pushed_at":"2019-11-04T06:15:21.000Z","size":22,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-25T23:59:44.016Z","etag":null,"topics":["api","combo","koa","koa2","middleware","node","proxy"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-15T01:56:51.000Z","updated_at":"2019-11-04T06:14:46.000Z","dependencies_parsed_at":"2022-09-12T11:02:14.213Z","dependency_job_id":null,"html_url":"https://github.com/yss/koa-api-combo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yss/koa-api-combo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yss%2Fkoa-api-combo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yss%2Fkoa-api-combo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yss%2Fkoa-api-combo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yss%2Fkoa-api-combo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yss","download_url":"https://codeload.github.com/yss/koa-api-combo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yss%2Fkoa-api-combo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32832819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","combo","koa","koa2","middleware","node","proxy"],"created_at":"2024-11-16T13:06:17.689Z","updated_at":"2026-05-09T19:31:17.096Z","avatar_url":"https://github.com/yss.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# koa-api-combo\nproxy multiple http or https requests, and response the result array by combine all the result.\n\n## Usage\n\n```js\nconst Combo = require('koa-api-combo');\n\n// GET /combo?urls=encodeURIComponent('/x,/xx?xxx,/xxx')\u0026...\napp.use(Combo('/combo', { apiHost: 'a.com' });\n// equals to\n// GET /x?...\n// GET /xx?xxx\u0026...\n// GET /xxx?...\n\n// GET /combo?urls=encodeURIComponent('/x,/xx?xxx,/xxx')\u0026...\n// GET /combo/ignore?urls=encodeURIComponent('/x,/xx?xxx,/xxx')\u0026...\n// the request result data will be set to null if the request is error\n// and the result should be like [null] [null, {\"a\":1}] ...\napp.use(Combo.withIgnoreError('/combo', { apiHost: 'a.com' }));\n```\n\n## Install\n\n```sh\nnpm install koa-api-combo --save\n```\n\n## Middleware\n\n### `Combo(path, comboConfig, apiRequestConfig)`\n\n* @param {string} path is the route string. And should be exactly equal to `ctx.path`\n* @param {Object} apiRequestConfig the same as ApiRequest\n* @param {Object} comboConfig\n* @param {boolean} [comboConfig.supportIgnoreError] will use null instead the response data if request url error,\n*       and need request by append `/ignore` to the `path` parameter if set to true\n* @param {Function} [comboConfig.isValidUrl] for filter possible illegal url if needed,\n        and response 400 with parameters error\n\n### `ApiRequest(config)`\n\n* @param {string} config.apiHost\n* @param {number} [config.port]\n* @param {string} [config.protocol=http] the protocol that request api server\n* @param {number} [config.dnsCacheTime=10] the time for dns cache, default 10 seconds, do not use dns cache if set 0\n* @param {number} [config.timeout=7] timeout for each api request, default 7 seconds\n* @param {boolean} [config.compress=false] whether accept encoding from api server, and only gzip and deflate support.\n* @param {string} [config.headers='Cookie,User-Agent,Referrer'] the header you want to send to api server\n\n### Query\n\nThe key of query is `urls`.\n\nThe value is the url array separate from `,`, and should encode it by use `encodeURIComponent`.\n\nEach url can have `?` and `\u0026`, and will append with the querystring from `ctx.querystring` except `urls`.\n\nSo this means parameters are shared by each url if you set other parameter but `urls` to current request.\n\nSome Example:\n\n```html\nGET /combo?urls=/a,/b\u0026p=1 # urls=encodeURIComponent('/a,/b')\n// equivalent to\n// /a?p=1 and /b?p=1\n\nGET /combo?h=2\u0026urls=/a?c=1,/b?p=1\u0026p=1 # urls=encodeURIComponent('/a?c=1,/b?p=1')\n// equivalent to\n// /a?c=1\u0026h=2\u0026p=1 and /b?p=1\u0026h=2\u0026p=1\n```\n\nNote::: it just append to the url for the same query! And query from url is first.\n\n## Test\n\n`npm test`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyss%2Fkoa-api-combo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyss%2Fkoa-api-combo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyss%2Fkoa-api-combo/lists"}