{"id":13583069,"url":"https://github.com/dekelev/feathers-kong","last_synced_at":"2025-05-12T12:42:53.493Z","repository":{"id":34407177,"uuid":"178601487","full_name":"dekelev/feathers-kong","owner":"dekelev","description":"A Feathers service for Kong API Gateway admin API","archived":false,"fork":false,"pushed_at":"2023-07-18T21:52:24.000Z","size":557,"stargazers_count":10,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-18T08:53:05.050Z","etag":null,"topics":["api-gateway","feathers","feathersjs","kong","kong-admin"],"latest_commit_sha":null,"homepage":null,"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/dekelev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2019-03-30T19:18:56.000Z","updated_at":"2023-02-13T07:04:44.000Z","dependencies_parsed_at":"2024-01-18T09:06:27.407Z","dependency_job_id":"17b9e4de-6d39-4f5c-b595-3123ce3cd210","html_url":"https://github.com/dekelev/feathers-kong","commit_stats":{"total_commits":33,"total_committers":3,"mean_commits":11.0,"dds":0.4545454545454546,"last_synced_commit":"6a8afa3197afad6fd0cb8d22c0a8f62475ff2812"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dekelev%2Ffeathers-kong","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dekelev%2Ffeathers-kong/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dekelev%2Ffeathers-kong/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dekelev%2Ffeathers-kong/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dekelev","download_url":"https://codeload.github.com/dekelev/feathers-kong/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253742400,"owners_count":21957018,"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-gateway","feathers","feathersjs","kong","kong-admin"],"created_at":"2024-08-01T15:03:14.350Z","updated_at":"2025-05-12T12:42:53.463Z","avatar_url":"https://github.com/dekelev.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Plugins"],"sub_categories":["Utilities"],"readme":"# feathers-kong\n\n[![Build Status](https://travis-ci.org/dekelev/feathers-kong.svg?branch=master)](https://travis-ci.org/dekelev/feathers-kong)\n[![Coverage Status](https://coveralls.io/repos/github/dekelev/feathers-kong/badge.svg?branch=master)](https://coveralls.io/github/dekelev/feathers-kong?branch=master)\n[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://standardjs.com/)\n[![Dependency Status](https://img.shields.io/david/dekelev/feathers-kong.svg)](https://david-dm.org/dekelev/feathers-kong)\n[![npm](https://img.shields.io/npm/v/feathers-kong.svg?maxAge=3600)](https://www.npmjs.com/package/feathers-kong)\n\n\u003e A Feathers service for [Kong API Gateway](https://docs.konghq.com) admin API\n\n## Installation\n\n```\nnpm install feathers-kong --save\n```\n\n## Documentation\n\nPlease refer to the [Kong admin API docs](https://docs.konghq.com/1.0.x/admin-api/) for options that can be passed. Feathers service methods map to the following Kong methods:\n\n- Feathers `find` -\u003e Kong `list` all or when not using `Consumer` service, list resources of consumer by setting `params.query.consumer` with Kong consumer ID\n- Feathers `get` -\u003e Kong `get` resource by id by setting `id` with resource ID \u0026 when not using `Consumer` service, set `params.query.consumer` with Kong consumer ID. otherwise it will return consumer by resource ID when supported\n- Feathers `create` -\u003e Kong `create` resource. set `params.query.consumer` to create resource on consumer\n- Feathers `patch` -\u003e Kong `update` resource by id\n- Feathers `update` -\u003e Kong `update` resource by id\n- Feathers `remove` -\u003e Kong `delete` resource by id\n\nIf a method is not supported by Kong for a given resource it is not support here as well.\n\n### Available Services\n\nThe following services are supported and map to the appropriate Kong resource:\n\n- `Consumer`\n- `Acl`\n- `Jwt`\n- `KeyAuth`\n\n\n**This is pretty important!** Since this connects to your Kong admin API, you want to make sure that you don't expose these endpoints via your app unless the user has the appropriate permissions. You can prevent any external access by doing this:\n\n```js\nconst { Forbidden } = require('@feathersjs/errors');\n\napp.service('/kong/consumers').before({\n  all: [\n    context =\u003e {\n      if (context.params.provider) {\n        throw new Forbidden('You are not allowed to access this');\n      }\n    }\n  ]\n});\n```\n\n## Complete Example\n\nHere's an example of a Feathers server that uses `feathers-authentication` for local auth.  It includes a `users` service that uses `feathers-mongoose`.  *Note that it does NOT implement any authorization.*\n\n```js\nconst feathers = require('@feathersjs/feathers');\nconst express = require('@feathersjs/express');\nconst socketio = require('@feathersjs/socketio');\nconst { Consumer } = require('feather-kong');\n\n// Initialize the application\nconst app = feathers()\n  .configure(express.rest())\n  .configure(socketio())\n  // Needed for parsing bodies (login)\n  .use(express.json())\n  .use(express.urlencoded({ extended: true }))\n  // A simple Message service that we can used for testing\n  .use('/kong/consumers', new Consumer({ url: 'http://localhost:8001' }))\n  .use('/', feathers.static(__dirname + '/public'))\n  .use(express.errorHandler({ html: false }));\n\n\nfunction validateConsumer() {\n  return function(hook) {\n    console.log('Validating consumer code goes here');\n  };\n}\n\n\nconst consumerService = app.service('kong/consumers');\n\nconsumerService.before({\n  create: [validateConsumer()]\n});\n\nconst consumer = {\n  username: 'john',\n  custom_id: 'u1'\n};\n\nconsumerService.create(consumer).then(result =\u003e {\n  console.log('Consumer created', result);\n}).catch(error =\u003e {\n  console.log('Error creating consumer', error);\n});\n\napp.listen(3030);\n\nconsole.log('Feathers authentication app started on 127.0.0.1:3030');\n```\n\n## License\n\nCopyright (c) 2019\n\nLicensed under the [MIT license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdekelev%2Ffeathers-kong","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdekelev%2Ffeathers-kong","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdekelev%2Ffeathers-kong/lists"}