{"id":17806211,"url":"https://github.com/pdsuwwz/koa-server-boilerplate","last_synced_at":"2025-04-09T23:41:36.270Z","repository":{"id":59168797,"uuid":"438867942","full_name":"pdsuwwz/koa-server-boilerplate","owner":"pdsuwwz","description":"☂️ A boilerplate for Koa Server with Typescript, Babel, and Rollup","archived":false,"fork":false,"pushed_at":"2025-04-09T19:02:54.000Z","size":328,"stargazers_count":1,"open_issues_count":13,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T20:21:17.207Z","etag":null,"topics":["babel","boilerplate","eslint","hmr-support","koa-server","koa2","nodemon","pm2","rollup","typescript"],"latest_commit_sha":null,"homepage":"","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/pdsuwwz.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-16T05:13:56.000Z","updated_at":"2023-03-29T08:53:58.000Z","dependencies_parsed_at":"2024-02-21T03:15:48.781Z","dependency_job_id":"325b7ade-516e-48e0-940e-d072038e6c45","html_url":"https://github.com/pdsuwwz/koa-server-boilerplate","commit_stats":{"total_commits":30,"total_committers":2,"mean_commits":15.0,"dds":"0.43333333333333335","last_synced_commit":"919036ca56a308bfe2097063a79f7dbfda1681b6"},"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdsuwwz%2Fkoa-server-boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdsuwwz%2Fkoa-server-boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdsuwwz%2Fkoa-server-boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdsuwwz%2Fkoa-server-boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pdsuwwz","download_url":"https://codeload.github.com/pdsuwwz/koa-server-boilerplate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248131468,"owners_count":21052819,"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":["babel","boilerplate","eslint","hmr-support","koa-server","koa2","nodemon","pm2","rollup","typescript"],"created_at":"2024-10-27T13:04:49.289Z","updated_at":"2025-04-09T23:41:36.249Z","avatar_url":"https://github.com/pdsuwwz.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# koa-server-boilerplate\n☂️ A boilerplate for Koa Server with Typescript, Babel, and Rollup\n\n\n## Prerequisites\n\nPlease make sure that [Node.js](https://nodejs.org/) (\u003e= 10.18.1) is installed on your operating system.\n\n## Feature\n\n🌟 Separation Services logic and Controllers.\n\n🍓 The Friendly practice for Koa project.\n\n🌲 Configured routing.\n\n☃ `Eslint` configuration.\n\n⚡ Fast build with `Rollup`.\n\n🔥 HMR.\n\n## Project structure\n\n```\n├── src\n│   ├── controllers/ ---  Server controllers\n│   ├── services/    ---  Server services\n│   ├── config.ts    ---  About Environments variable\n│   ├── main.ts      ---  Entry file\n│   └── routes.ts    ---  Configs for routing controllers\n```\n\n## Installation\n\n```bash\npnpm install\n```\n\n## Running Development\n\n```bash\npnpm dev\n```\n\n## Running Production\n\nThe project has built-in a `pm2`, when the `build` is completed, you can running the `pnpm start`, which will automatically manage the process by `pm2`.\n\nRun `pnpm build` to build:\n```bash\npnpm build\n```\n\nAll done! Now run this in your terminal:\n```bash\npnpm start\n```\n\n## Simple API\n\n\u003e `/api` is the prefix for all routes.\n\n* `GET /api`\n\nHealth check.\n\n```bash\ncurl --location --request GET \\\n'http://localhost:5000/api'\n```\n\n* `GET /api/get_userinfo`\n\nGet User Info.\n\n```bash\ncurl --location --request GET \\\n'http://localhost:5000/api/get_userinfo?userId=1234567'\n```\n\n* `POST /api/gen_image`\n\nGenerate a image to response.\n\n```bash\ncurl --location --request POST 'http://localhost:5000/api/gen_image' \\\n--header 'Content-Type: application/x-www-form-urlencoded' \\\n--data-urlencode 'url=http://www.google.com' --output test-image.png\n```\n\n\n## Routing\n\nIn order to make the routing information more readable and transparent, the form of configuration is adopted here.\n\nYou can create an `array` and then write the routing meta information into the `array`, and reuse it in the `src/routes.ts`\n\n```ts\nconst routes: Array\u003cRouteConfig\u003e = [\n  {\n    path: '/',\n    method: 'get',\n    action: HomeController.hello\n  },\n  // here...\n]\n```\n\n# License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpdsuwwz%2Fkoa-server-boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpdsuwwz%2Fkoa-server-boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpdsuwwz%2Fkoa-server-boilerplate/lists"}