{"id":22561780,"url":"https://github.com/bpcloud/middleware","last_synced_at":"2026-02-26T00:45:38.710Z","repository":{"id":79322744,"uuid":"346560770","full_name":"bpcloud/middleware","owner":"bpcloud","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-21T10:08:53.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-02T13:15:02.969Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"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/bpcloud.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":"2021-03-11T03:01:42.000Z","updated_at":"2025-01-21T10:08:56.000Z","dependencies_parsed_at":"2023-03-23T17:05:32.250Z","dependency_job_id":null,"html_url":"https://github.com/bpcloud/middleware","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpcloud%2Fmiddleware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpcloud%2Fmiddleware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpcloud%2Fmiddleware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpcloud%2Fmiddleware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bpcloud","download_url":"https://codeload.github.com/bpcloud/middleware/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246034225,"owners_count":20712851,"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":[],"created_at":"2024-12-07T22:09:45.296Z","updated_at":"2025-11-04T02:04:23.843Z","avatar_url":"https://github.com/bpcloud.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# bpframework Middleware specification\n\nThe middleware must have below methods:\n\n```js\ninterface BpframeworkMiddleware {\n  /** name of middleware */\n  name: string,\n  /** web framework type. e.g. 'koa' **/\n  type: string,\n  /** initiator the middleware */\n  initiator: (app:any, bpApp:any)=\u003evoid,\n  /** The framework context finished, all objects of framework, e.g. FeignClient, start working. */\n  contextFinished?: (app:any, bpApp:any)=\u003evoid,\n  /** call before route */\n  beforeRoute?: (app:any, bpApp:any, request?:any)=\u003ePromise\u003cboolean\u003e,\n  /** call after route */\n  afterRoute?: (app:any, bpApp:any)=\u003ePromise\u003cboolean\u003e,\n}\n```\n\n`initiator` -\u003e `contextFinished` -\u003e `beforeRoute` -\u003e `afterRoute`\n\nExample:\n\n```js\nexport default {\n  name: 'test-middleware',\n  type: 'koa',\n  initiator(app, bpApp) {\n\n  },\n  async beforeRoute(ctx, bpApp, request): boolean {\n    // To interrupt process of follow-up .\n    return false;\n  },\n  async afterRoute(ctx, bpApp): boolean {\n    // To interrupt process of follow-up.\n    return false;\n  },\n}\n```\n\n### List\n\n| name           | descs                                                |\n| -------------- | ---------------------------------------------------- |\n| koa-i18n       | https://github.com/bpcloud/middleware-koa-i18n       |\n| koa-bodyparser | https://github.com/bpcloud/middleware-koa-bodyparser |\n| koa-cors       | https://github.com/bpcloud/middleware-koa-cors       |\n| koa-session    | https://github.com/bpcloud/middleware-koa-session    |\n| redis          | https://github.com/bpcloud/middleware-redis          |\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbpcloud%2Fmiddleware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbpcloud%2Fmiddleware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbpcloud%2Fmiddleware/lists"}