{"id":27786341,"url":"https://github.com/clever/discovery-node","last_synced_at":"2025-04-30T15:59:47.499Z","repository":{"id":42613006,"uuid":"42619623","full_name":"Clever/discovery-node","owner":"Clever","description":"Programmatically find services (like discovery-go, but for node)","archived":false,"fork":false,"pushed_at":"2025-01-02T16:28:24.000Z","size":151,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":62,"default_branch":"master","last_synced_at":"2025-03-17T16:53:17.265Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Clever.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":"2015-09-16T23:47:09.000Z","updated_at":"2025-01-02T16:28:22.000Z","dependencies_parsed_at":"2024-11-13T20:22:31.699Z","dependency_job_id":"ed212761-f85c-4795-ab28-6c1c519fef7c","html_url":"https://github.com/Clever/discovery-node","commit_stats":{"total_commits":44,"total_committers":16,"mean_commits":2.75,"dds":0.7954545454545454,"last_synced_commit":"c8ddfe7aae49c2910d12f023d8fb07a362fe7c56"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clever%2Fdiscovery-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clever%2Fdiscovery-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clever%2Fdiscovery-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clever%2Fdiscovery-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Clever","download_url":"https://codeload.github.com/Clever/discovery-node/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251737991,"owners_count":21635715,"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":"2025-04-30T15:59:46.144Z","updated_at":"2025-04-30T15:59:47.491Z","avatar_url":"https://github.com/Clever.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# discovery-node\n\nThis library programmatically finds endpoints for dependencies. Similar to [discovery-go](https://github.com/Clever/discovery-go) and [discovery-python](https://github.com/Clever/discovery-python).\n\nSee [Service Discovery](https://clever.atlassian.net/wiki/spaces/ENG/pages/116686857/Discovery) for more details.\n\n## API\n\n- disc = **discovery**(\\\u003cservice\\\u003e, \\\u003cinterface\\\u003e)\n  - disc.**proto**() - returns the service protocol\n  - disc.**host**() - returns the hostname or ip\n  - disc.**port**() - returns the port\n  - disc.**host_port**() - returns (\\\u003chost\\\u003e:\\\u003cport\\\u003e)\n  - disc.**proto_host**() - returns (\\\u003cproto\\\u003e://\\\u003chost\\\u003e)\n  - disc.**url**() - returns the url (\\\u003cproto\\\u003e://\\\u003chost\\\u003e:\\\u003cport\\\u003e)\n\n- external_url(\\\u003curl\\\u003e) - returns the external url to use\n\n### Install and import\n\n```bash\nnpm install --save clever-discovery\n```\n\n```node\nimport { discovery, external_url } from \"clever-discovery\"\n```\n\n### Examples\n\n```node\ndisc_gearman = discovery(\"gearman-admin\", \"http\")\ntry gearman_url = disc_gearman.url() catch err then cb(err)\n\ndisc_systemic = discovery(\"systemic\", \"thrift\")\ntry systemic_host = disc_systemic.host() catch err then cb(err)\ntry systemic_port = disc_systemic.port() catch err then cb(err)\n\ntry clever_com_url = external_url(\"clever.com\") catch err then cb(err)\n```\n\nTo see what interfaces a Clever service exposes, check its launch yaml. You should see one or more exposes listed, and the `name` of the expose is used as the `interface` value in the discovery client.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclever%2Fdiscovery-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclever%2Fdiscovery-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclever%2Fdiscovery-node/lists"}