{"id":19543607,"url":"https://github.com/nodecloud/nodecloud-gateway","last_synced_at":"2025-08-27T19:32:15.957Z","repository":{"id":65463276,"uuid":"111897127","full_name":"nodecloud/nodecloud-gateway","owner":"nodecloud","description":"nodecloud-gateway","archived":false,"fork":false,"pushed_at":"2019-05-12T12:15:33.000Z","size":143,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-09T11:04:14.941Z","etag":null,"topics":[],"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/nodecloud.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-11-24T08:56:40.000Z","updated_at":"2019-05-12T12:15:34.000Z","dependencies_parsed_at":"2023-03-10T18:48:10.390Z","dependency_job_id":null,"html_url":"https://github.com/nodecloud/nodecloud-gateway","commit_stats":{"total_commits":45,"total_committers":4,"mean_commits":11.25,"dds":0.2666666666666667,"last_synced_commit":"e6e06a1a81b01712ffb385cea351df363d2dd061"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodecloud%2Fnodecloud-gateway","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodecloud%2Fnodecloud-gateway/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodecloud%2Fnodecloud-gateway/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodecloud%2Fnodecloud-gateway/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nodecloud","download_url":"https://codeload.github.com/nodecloud/nodecloud-gateway/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240798654,"owners_count":19859404,"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-11-11T03:19:57.042Z","updated_at":"2025-02-26T05:29:49.373Z","avatar_url":"https://github.com/nodecloud.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nodecloud-gateway\n\n[nodecloud-gateway](https://github.com/nodecloud/nodecloud-gateway) is a gateway component in microsoft service system. It is inspired by [Zuul](https://github.com/Netflix/zuul). It is based on [koa](http://koajs.com/) middleware mechanism.\n\n**The lib is developing without any production verifications**\n\n## Get Started\n\nInstall it via npm:\n\n```shell\nnpm install --save nodecloud-gateway\n```\n\nImplements a filter extends `PreGatewayFilter`(or `AbstractGatewayFilter`, `RouteGatewayFilter`, `PostGatewayFilter`).\n\nThe filter which extends `PreGatewayfilter` will be executed first. The following filters extend `RouteGatewayFilter` and `PostGatewayFilter` classes.\n\n```javascript\nimport {PreGatewayFilter} from 'nodecloud-gateway';\n\nexport default class DebugPreGatewayFilter extends PreGatewayFilter {\n    constructor(app) {\n        super(app);\n    }\n\n    // Likes the koa middleware\n    async action(ctx) {\n        ctx.set('x-gateway', true);\n    }\n}\n```\n\n\nUse it with koa framework:\n\n```javascript\nimport Koa from 'koa';\nimport {NodeGateway} from 'nodecloud-gateway';\n\nimport DebugPreGatewayFilter from './DebugPreGatewayFilter'\n\nconst gateway = new NodeGateway();\nconst app = new Koa();\n\n// All responses have the header 'x-gateway: true'\ngateway.init(app, [DebugPreGatewayFilter])\n\n// other koa logic and middlewares\napp.listen(3000);\n```\n\nUse it with [nodecloud-boot](https://github.com/nodecloud/nodecloud-boot), and You must create `routeConfig`\n\n```javascript\nimport NCBoot from 'nodecloud-boot';\nimport Koa from 'koa';\nimport {NodeGateway} from 'nodecloud-gateway';\n\nconst ncBoot = NCBoot.getInstance(__dirname);\nconst app = new Koa();\nconst gateway = new NodeGateway();\nconst routeConfig = {\n    prefix: '/api',\n    routes: {\n      'service0': {\n          path: '/example1/**'\n      },\n      'service1': {\n          path: '/example/**',\n          ignorePattern: /\\/example\\/a\\//\n      }\n    }\n};\n\nncBoot.initApp(()=\u003e{\n    // other koa logic and middlewares\n    \n    NodeGateway.initWithService(app, null, routeConfig, ncboot.client);\n    return app.callback();\n})\n\n```\n\n## API\n\n### routeConfig\n\n```javascript\n\n```\n\n## Issues\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodecloud%2Fnodecloud-gateway","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnodecloud%2Fnodecloud-gateway","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodecloud%2Fnodecloud-gateway/lists"}