{"id":21291879,"url":"https://github.com/idea2app/github-restful-middleware","last_synced_at":"2026-02-24T09:33:05.946Z","repository":{"id":98205730,"uuid":"106139394","full_name":"idea2app/GitHub-RESTful-middleware","owner":"idea2app","description":"Express \u0026 Koa compatible middleware for GitHub RESTful API","archived":false,"fork":false,"pushed_at":"2024-09-02T23:16:47.000Z","size":341,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-26T04:32:34.072Z","etag":null,"topics":["express","github","koa","middleware","restful-api"],"latest_commit_sha":null,"homepage":"https://idea2app.github.io/GitHub-RESTful-middleware/","language":"TypeScript","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/idea2app.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-08T00:21:20.000Z","updated_at":"2024-09-02T23:16:23.000Z","dependencies_parsed_at":"2024-09-13T15:32:11.121Z","dependency_job_id":"e0de4eac-2da6-434a-b15f-212159cb5b82","html_url":"https://github.com/idea2app/GitHub-RESTful-middleware","commit_stats":null,"previous_names":["idea2app/github-restful-middleware","techquery/express-github"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/idea2app/GitHub-RESTful-middleware","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idea2app%2FGitHub-RESTful-middleware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idea2app%2FGitHub-RESTful-middleware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idea2app%2FGitHub-RESTful-middleware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idea2app%2FGitHub-RESTful-middleware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/idea2app","download_url":"https://codeload.github.com/idea2app/GitHub-RESTful-middleware/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idea2app%2FGitHub-RESTful-middleware/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29777887,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T04:54:30.205Z","status":"ssl_error","status_checked_at":"2026-02-24T04:53:58.628Z","response_time":75,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["express","github","koa","middleware","restful-api"],"created_at":"2024-11-21T13:46:33.812Z","updated_at":"2026-02-24T09:33:05.899Z","avatar_url":"https://github.com/idea2app.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitHub-RESTful-middleware\n\n[Express][1] \u0026 [Koa][2] compatible middleware for [GitHub RESTful API][3]\n\n[![NPM Dependency](https://img.shields.io/librariesio/github/idea2app/GitHub-RESTful-middleware.svg)][5]\n[![CI \u0026 CD](https://github.com/idea2app/GitHub-RESTful-middleware/actions/workflows/main.yml/badge.svg)][6]\n\n[![NPM](https://nodei.co/npm/github-restful-middleware.png?downloads=true\u0026downloadRank=true\u0026stars=true)][7]\n\n## Version\n\n| SemVer  |  branch  |    status    |  language  |   framework   | API schema |\n| :-----: | :------: | :----------: | :--------: | :-----------: | :--------: |\n| `\u003e=0.6` |  `main`  | ✅developing | TypeScript | Express \u0026 Koa |  Swagger   |\n| `\u003c0.6`  | `master` | ❌deprecated | ECMAScript |    Express    |   APIDoc   |\n\n## Feature\n\n1.  [**OAuth 2.0**][8] (Production Environment can be used for debugging of `localhost`)\n\n2.  **API Proxy** (HTTP-only **Cookie Session** instead of Access Token is easy to use for Web front-end)\n\n3.  Wrapper APIs to get the **Technique(Language) list** of a User or Organization\n\n4.  **Diff to HTML** (Get `/repos/:owner/:repo/pull/:pull_num.diff` with `Accept: text/html`, the Diff Code will be converted to HTML by [diff2html][9])\n\n5.  One **Hook URL** to receive all kinds of Event\n\n6.  3 APIs of [Server-sent events][10] about Organization \u0026 Repository\n\n## Usage\n\n-   [API Document][11]\n\n### with Koa\n\nThe sample codes shown below will serve all the APIs of GitHub RESTful middleware with Koa, [Swagger][12] UI + JSON spec \u0026 Mock APIs.\n\n#### Install command\n\n```shell\nnpm i github-restful-middleware koa koa-logger koa2-swagger-ui koagger routing-controllers\n```\n\n#### Core logic (`index.ts`)\n\n```ts\nimport Koa from 'koa';\nimport KoaLogger from 'koa-logger';\nimport type {} from 'koa2-swagger-ui';\nimport { createAPI } from 'koagger';\nimport { useKoaServer } from 'routing-controllers';\nimport { controllers } from 'github-restful-middleware';\n\nconst { NODE_ENV, PORT = 8080 } = process.env;\nconst isProduct = NODE_ENV === 'production';\n\nexport const { swagger, mocker, router } = createAPI({\n    mock: !isProduct,\n    controllers // other controllers of your own can be added here\n});\nconst app = new Koa().use(KoaLogger()).use(swagger({ exposeSpec: true }));\n\nif (!isProduct) app.use(mocker());\n\nuseKoaServer(app, { ...router, cors: true });\n\nconsole.time('Server boot');\n\napp.listen(PORT, () =\u003e console.timeEnd('Server boot'));\n```\n\n#### Boot command\n\n```shell\nnpx tsx index.ts\n```\n\n### with Express\n\nJust relpace `useKoaServer()` with `useExpressServer()` in [`routing-controllers`][13] \u0026 other equivalent middlewares for Express.\n\n[1]: https://expressjs.com/\n[2]: https://koajs.com/\n[3]: https://docs.github.com/en/rest\n[5]: https://libraries.io/npm/github-restful-middleware\n[6]: https://github.com/idea2app/GitHub-RESTful-middleware/actions/workflows/main.yml\n[7]: https://nodei.co/npm/github-restful-middleware/\n[8]: https://oauth.net/2/\n[9]: https://diff2html.xyz/\n[10]: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events\n[11]: https://idea2app.github.io/GitHub-RESTful-middleware/\n[12]: https://swagger.io/\n[13]: https://github.com/typestack/routing-controllers\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidea2app%2Fgithub-restful-middleware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidea2app%2Fgithub-restful-middleware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidea2app%2Fgithub-restful-middleware/lists"}