{"id":18317876,"url":"https://github.com/idiocc/koa","last_synced_at":"2025-04-09T13:51:07.969Z","repository":{"id":57113712,"uuid":"186271001","full_name":"idiocc/koa","owner":"idiocc","description":"The Koa2 Fork Optimized With Google Closure Compiler That Has Just 1 Dependency (mime-db).","archived":false,"fork":false,"pushed_at":"2019-12-21T05:57:03.000Z","size":689,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-17T09:50:21.514Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.idio.cc","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/idiocc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":null,"patreon":null,"open_collective":"nodetools","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://www.artd.eco"]}},"created_at":"2019-05-12T15:20:52.000Z","updated_at":"2021-07-02T17:12:49.000Z","dependencies_parsed_at":"2022-08-22T05:31:14.667Z","dependency_job_id":null,"html_url":"https://github.com/idiocc/koa","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idiocc%2Fkoa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idiocc%2Fkoa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idiocc%2Fkoa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idiocc%2Fkoa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/idiocc","download_url":"https://codeload.github.com/idiocc/koa/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054218,"owners_count":21039951,"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":"2024-11-05T18:07:45.436Z","updated_at":"2025-04-09T13:51:07.943Z","avatar_url":"https://github.com/idiocc.png","language":"JavaScript","funding_links":["https://opencollective.com/nodetools","https://www.artd.eco"],"categories":[],"sub_categories":[],"readme":"# @goa/koa\n\n[![npm version](https://badge.fury.io/js/%40goa%2Fkoa.svg)](https://www.npmjs.com/package/@goa/koa)\n\n`@goa/koa` is the [Koa web-sever](https://koajs.com) compiled and optimised with _Google Closure Compiler_ so that it has only 1 dependency (`mime-db`, for easy access to upgrades). The types are written as JSDoc and don't require installing typings. The aim of this project is to demonstrate how to modernise the old-school NPM package making, including starting to use import/export statements without _Babel_, restoring to pure _JSDoc_ without TypeScript, and compiling the code into the single executable using the compiler, and testing the code with [_Zoroaster_](https://contexttesting.com) testing framework which is twice as fast and weighs 500KB against 50MB compared with _Jest_ (as used in the original repository).\n\n\u003ctable\u003e\n\u003ctr\u003e\u003cth colspan=\"2\"\u003e@Goa/Koa Source Code Is ~2000 Lines Of Code\u003c/th\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd colspan=\"2\"\u003e\n\u003cimg src=\"doc/ic.png\" alt=\"@Goa/Koa Compiled Source Code.\"\u003e\n\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\n \u003ctd align=\"center\"\u003e\n  \u003cstrong\u003eYarn Install\u003c/strong\u003e\n \u003c/td\u003e\n \u003ctd align=\"center\"\u003e\n  \u003cstrong\u003eNPM Install\u003c/strong\u003e\n \u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n \u003ctd align=\"center\"\u003e\n\n```sh\nyarn add @goa/koa\n```\n \u003c/td\u003e\n \u003ctd align=\"center\"\u003e\n\n```sh\nnpm install @goa/koa\n```\n \u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\nThis package actually compiles the [Goa Source Code](https://github.com/idiocc/goa). You can find all the documentation on that package's page.\n\n## Table Of Contents\n\n- [Table Of Contents](#table-of-contents)\n- [API](#api)\n  * [`constructor(options=)`](#constructoroptions-applicationoptions-application)\n- [Copyright \u0026 License](#copyright--license)\n\n\u003cp align=\"center\"\u003e\u003ca href=\"#table-of-contents\"\u003e\n  \u003cimg src=\"/.documentary/section-breaks/0.svg?sanitize=true\"\u003e\n\u003c/a\u003e\u003c/p\u003e\n\n## API\n\nThe package is available by importing its default class:\n\n```js\nimport Goa from '@goa/koa'\n```\n\n\u003cp align=\"center\"\u003e\u003ca href=\"#table-of-contents\"\u003e\n  \u003cimg src=\"/.documentary/section-breaks/1.svg?sanitize=true\"\u003e\n\u003c/a\u003e\u003c/p\u003e\n\n\n### \u003ccode\u003e\u003cins\u003econstructor\u003c/ins\u003e(\u003c/code\u003e\u003csub\u003e\u003cbr/\u003e\u0026nbsp;\u0026nbsp;`options=: ApplicationOptions,`\u003cbr/\u003e\u003c/sub\u003e\u003ccode\u003e): \u003ci\u003eApplication\u003c/i\u003e\u003c/code\u003e\n\nCreates a new app instance.\n\n - \u003ckbd\u003eoptions\u003c/kbd\u003e \u003cem\u003e\u003ccode\u003e\u003ca href=\"https://github.com/idiocc/goa/wiki/Application#type-applicationoptions\" title=\"Options for the application constructor.\"\u003eApplicationOptions\u003c/a\u003e\u003c/code\u003e\u003c/em\u003e (optional): Options to create an application.\n\n\u003ctable\u003e\n\u003ctr\u003e\u003cth\u003e\u003ca href=\"example/index.js\"\u003eSource\u003c/a\u003e\u003c/th\u003e\u003cth\u003eOutput\u003c/th\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e\n\n```js\nimport aqt from '@rqt/aqt'\nimport Goa from '@goa/koa'\n\nconst goa = new Goa()\ngoa.use(async (ctx, next) =\u003e {\n  ctx.body = 'Hello World'\n  ctx.status = 201\n  ctx.message = 'example'\n  await next()\n})\ngoa.listen(3000, async function() {\n  const url = `http://localhost:3000`\n  console.log(url, '\\n')\n  const res = await aqt(url)\n  console.log(res)\n  this.close()\n})\n```\n\u003c/td\u003e\n\u003ctd\u003e\n\n```js\nhttp://localhost:3000 \n\n{ body: 'Hello World',\n  headers: \n   { 'content-type': 'text/plain; charset=utf-8',\n     'content-length': '11',\n     date: 'Sat, 21 Dec 2019 05:10:34 GMT',\n     connection: 'close' },\n  statusCode: 201,\n  statusMessage: 'example' }\n```\n\u003c/td\u003e\u003c/tr\u003e\n\u003c/table\u003e\n\n\u003cp align=\"center\"\u003e\u003ca href=\"#table-of-contents\"\u003e\n  \u003cimg src=\"/.documentary/section-breaks/2.svg?sanitize=true\"\u003e\n\u003c/a\u003e\u003c/p\u003e\n\n## Copyright \u0026 License\n\nGNU Affero General Public License v3.0\n\nOriginal work on the [Koa Web Server](https://github.com/koajs/koa) by its authors under MIT License found in [Goa's Source Code](https://github.com/idiocc/goa/blob/master/COPYING) repository.\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003cth\u003e\n      \u003ca href=\"https://artd.eco\"\u003e\n        \u003cimg width=\"100\" src=\"https://raw.githubusercontent.com/wrote/wrote/master/images/artdeco.png\"\n          alt=\"Art Deco\"\u003e\n      \u003c/a\u003e\n    \u003c/th\u003e\n    \u003cth\u003e© \u003ca href=\"https://artd.eco\"\u003eArt Deco\u003c/a\u003e for \u003ca href=\"https://idio.cc\"\u003eIdio\u003c/a\u003e 2019\u003c/th\u003e\n    \u003cth\u003e\n      \u003ca href=\"https://idio.cc\"\u003e\n        \u003cimg src=\"https://avatars3.githubusercontent.com/u/40834161?s=100\" width=\"100\" alt=\"Idio\"\u003e\n      \u003c/a\u003e\n    \u003c/th\u003e\n    \u003cth\u003e\n      \u003ca href=\"https://www.technation.sucks\" title=\"Tech Nation Visa\"\u003e\n        \u003cimg width=\"100\" src=\"https://raw.githubusercontent.com/idiocc/cookies/master/wiki/arch4.jpg\"\n          alt=\"Tech Nation Visa\"\u003e\n      \u003c/a\u003e\n    \u003c/th\u003e\n    \u003cth\u003e\u003ca href=\"https://www.technation.sucks\"\u003eTech Nation Visa Sucks\u003c/a\u003e\u003c/th\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003cp align=\"center\"\u003e\u003ca href=\"#table-of-contents\"\u003e\n  \u003cimg src=\"/.documentary/section-breaks/-1.svg?sanitize=true\"\u003e\n\u003c/a\u003e\u003c/p\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidiocc%2Fkoa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidiocc%2Fkoa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidiocc%2Fkoa/lists"}