{"id":28544649,"url":"https://github.com/lazuee/hono-emitter","last_synced_at":"2025-07-26T09:14:06.873Z","repository":{"id":298002578,"uuid":"997847232","full_name":"lazuee/hono-emitter","owner":"lazuee","description":"Event emitter-based route handler for HonoJS.","archived":false,"fork":false,"pushed_at":"2025-06-09T09:05:56.000Z","size":65,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-20T23:19:47.169Z","etag":null,"topics":["emitter","event-emitter","hono","route-handler"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@lazuee/hono-emitter","language":"TypeScript","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/lazuee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null}},"created_at":"2025-06-07T10:11:33.000Z","updated_at":"2025-06-20T18:30:05.000Z","dependencies_parsed_at":"2025-06-08T21:34:54.430Z","dependency_job_id":"c72d12e8-9b62-4856-bb18-355efec22bac","html_url":"https://github.com/lazuee/hono-emitter","commit_stats":null,"previous_names":["lazuee/hono-emitter"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/lazuee/hono-emitter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lazuee%2Fhono-emitter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lazuee%2Fhono-emitter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lazuee%2Fhono-emitter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lazuee%2Fhono-emitter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lazuee","download_url":"https://codeload.github.com/lazuee/hono-emitter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lazuee%2Fhono-emitter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267144572,"owners_count":24042637,"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","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["emitter","event-emitter","hono","route-handler"],"created_at":"2025-06-09T22:37:38.231Z","updated_at":"2025-07-26T09:14:06.849Z","avatar_url":"https://github.com/lazuee.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## hono-emitter\n\n\u003e `hono-emitter` is an Event emitter-based route handler for HonoJS.\n\n### Installation\n\n```bash\npnpm add -D @lazuee/hono-emitter\n```\n\n### Usage\n\n```ts\nimport { argv } from \"node:process\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { serve } from \"@hono/node-server\";\nimport { HonoEmitter } from \"@lazuee/hono-emitter\";\nimport { Hono } from \"hono\";\n\nconst isCLI = fileURLToPath(import.meta.url) === argv[1];\nconst app = new Hono().basePath(\"/api\").get(\"/ping\", (ctx) =\u003e ctx.text(\"pong\"));\n\nexport const emitter = new HonoEmitter(app, \"http://localhost:3000\")\n  .on(\"get:/world\", (ctx) =\u003e {\n    console.log(\"hello world\");\n    return ctx.text(\"hello world\");\n  })\n  .once(\"get:/world\", async (_ctx, next) =\u003e {\n    console.log(\"middleware start\");\n    await next();\n    console.log(\"middleware end\");\n  });\n\nemitter.on(\"get:/hello\", (ctx) =\u003e ctx.text(\"hello\")); // not included in typings (not chained)\n\nif (isCLI) {\n  // If running directly, start the server\n  serve({ ...app, port: 3000 }, () =\u003e {\n    console.log(\"server is running...\");\n  });\n}\n```\n\n#### Client types\n```ts\nimport { hc } from \"hono/client\";\nimport { emitter } from \".\";\n\nconst log =\n  \u003cS extends string\u003e(name: S) =\u003e\n  \u003cT extends Record\u003cstring, any\u003e\u003e(x: T) =\u003e\n    x.text().then((y: string) =\u003e console.log(`${name}:`, y));\n\nconst client = hc\u003ctypeof emitter.app\u003e(\"http://localhost:3000\");\nawait client.api.ping.$get().then(log(\"client[/api/ping]\"));\nawait client.api.world.$get().then(log(\"client[/api/world]\"));\n//@ts-expect-error - not available in types (not chained)\nawait client.api.hello.$get().then(log(\"client[/api/hello]\"));\n\nawait emitter.emit(\"get:/api/ping\").then(log(\"emitter[/api/ping]\"));\nawait emitter.emit(\"get:/api/world\").then(log(\"emitter[/api/world]\"));\n//@ts-expect-error - not available in types (not chained)\nawait emitter.emit(\"get:/api/hello\").then(log(\"emitter[/api/hello]\"));\n```\n\nFor a usage example, check the [app/](https://github.com/lazuee/hono-emitter/tree/main/app) directory.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](https://github.com/lazuee/hono-emitter/blob/main/LICENSE.md) file for details\n\nCopyright © `2025` `lazuee`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flazuee%2Fhono-emitter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flazuee%2Fhono-emitter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flazuee%2Fhono-emitter/lists"}