{"id":13736918,"url":"https://github.com/youngjuning/duck","last_synced_at":"2025-08-08T04:18:14.264Z","repository":{"id":57675356,"uuid":"285198858","full_name":"youngjuning/duck","owner":"youngjuning","description":"Simple dynamic router register for Deno","archived":false,"fork":false,"pushed_at":"2020-08-27T17:58:23.000Z","size":26,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-08T13:52:33.185Z","etag":null,"topics":["deno","duck","router","router-register"],"latest_commit_sha":null,"homepage":"https://deno.land/x/duck","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/youngjuning.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-05T06:19:55.000Z","updated_at":"2023-02-02T06:44:20.000Z","dependencies_parsed_at":"2022-09-26T18:20:41.151Z","dependency_job_id":null,"html_url":"https://github.com/youngjuning/duck","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/youngjuning/duck","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youngjuning%2Fduck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youngjuning%2Fduck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youngjuning%2Fduck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youngjuning%2Fduck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/youngjuning","download_url":"https://codeload.github.com/youngjuning/duck/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youngjuning%2Fduck/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269362324,"owners_count":24404523,"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-08-08T02:00:09.200Z","response_time":72,"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":["deno","duck","router","router-register"],"created_at":"2024-08-03T03:01:31.344Z","updated_at":"2025-08-08T04:18:14.241Z","avatar_url":"https://github.com/youngjuning.png","language":"TypeScript","readme":"# duck\n\n\u003cimg src=\"https://i.loli.net/2020/08/05/XBzRTIeoSnQc5vH.png\" width=\"150\"/\u003e\n\nA simple controller scanner and router register for deno!\n\n## API\n\n\u003e duck(router, controller_dir: string = 'controllers')\n\n## Usage\n\n### oak\n\n```ts\nimport { Application, Router } from \"https://deno.land/x/oak/mod.ts\";\nimport duck from \"https://deno.land/x/duck/mod.ts\";\n\nconst app = new Application();\nconst router = new Router();\nconst gaga = await duck(router);\n\napp.use(gaga.routes());\napp.use(gaga.allowedMethods());\n\nconsole.log(`🦕 oak server running at http://127.0.0.1:1998/ 🦕`);\n\nawait app.listen({ port: 1998 });\n```\n\nYour controllers just like: `controllers/helloworld.ts`:\n\n```ts\nimport { Context } from \"../deps.ts\";\n\nexport const name = \"helloworld\";\nexport const method = \"get\";\n\nexport default async (ctx: Context) =\u003e {\n  const { response } = ctx;\n  response.body = \"hello world!\";\n};\n```\n\n### servest\n\n```ts\nimport { createApp } from \"https://servestjs.org/@v1.1.1/mod.ts\";\nimport duck from \"https://deno.land/x/duck/mod.ts\";\n\nconst app = createApp();\n\nconst gaga = await duck(app);\ngaga.listen({ port: 1998 });\n\nconsole.log(`🦕 servest server running at http://127.0.0.1:1998/ 🦕`);\n```\n\nYour controllers just like: `controllers/helloworld.ts`:\n\n```ts\nimport { ServerRequest } from \"https://servestjs.org/@v1.1.1/mod.ts\";\n\nexport const name = \"helloworld\";\nexport const method = \"get\";\n\nexport default async (req: ServerRequest) =\u003e {\n  await req.respond({\n    status: 200,\n    body: \"Hello World!\",\n  })\n};\n```\n\n\n### abc\n\n```ts\nimport { Application } from \"https://deno.land/x/abc@v1/mod.ts\";\nimport duck from \"https://deno.land/x/duck/mod.ts\";\nconst app = new Application();\nconst gaga = await duck(app);\n\ngaga.start({ port: 1998 });\n\nconsole.log(`🦕 abc server running at http://127.0.0.1:1998/ 🦕`);\n```\n\nYour controllers just like: `controllers/helloworld.ts`:\n\n```ts\nimport { Context } from \"https://deno.land/x/abc@v1/mod.ts\";\n\nexport const name = \"helloworld\";\nexport const method = \"get\";\n\nexport default async (ctx: Context) =\u003e {\n  return 'Hello World!'\n};\n```\n","funding_links":[],"categories":["基础设施"],"sub_categories":["JAM Stack/静态站点"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoungjuning%2Fduck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyoungjuning%2Fduck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoungjuning%2Fduck/lists"}