{"id":18095756,"url":"https://github.com/pearofducks/podium-koa-podlet","last_synced_at":"2026-05-16T18:38:11.579Z","repository":{"id":141914560,"uuid":"183372030","full_name":"pearofducks/podium-koa-podlet","owner":"pearofducks","description":"Koa middleware for @podium/podlet","archived":false,"fork":false,"pushed_at":"2019-04-26T06:19:29.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-22T12:00:06.891Z","etag":null,"topics":["koa","podium"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/pearofducks.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":"2019-04-25T06:38:10.000Z","updated_at":"2020-02-22T15:14:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"e7aa6e16-56ef-4d98-931f-19983401ca99","html_url":"https://github.com/pearofducks/podium-koa-podlet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pearofducks/podium-koa-podlet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pearofducks%2Fpodium-koa-podlet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pearofducks%2Fpodium-koa-podlet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pearofducks%2Fpodium-koa-podlet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pearofducks%2Fpodium-koa-podlet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pearofducks","download_url":"https://codeload.github.com/pearofducks/podium-koa-podlet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pearofducks%2Fpodium-koa-podlet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33114693,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T04:41:52.686Z","status":"ssl_error","status_checked_at":"2026-05-16T04:41:52.009Z","response_time":115,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["koa","podium"],"created_at":"2024-10-31T19:11:05.544Z","updated_at":"2026-05-16T18:38:11.564Z","avatar_url":"https://github.com/pearofducks.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @podium/koa-podlet\n\nKoa plugin for @podium/podlet.\n\nModule for building [@podium/podlet] servers with [Koa]. For writing podlets,\nplease see the [Podium documentation].\n\n## Installation\n\n```bash\n$ npm install @podium/koa-podlet\n```\n\n## Requirements\n\nThis module requires Koa v2.0.0 or newer.\n\n## Simple usage\n\nBuild a simple podlet server:\n\n```js\nconst { KoaPodlet } = require('@podium/koa-podlet');\nconst Koa = require('koa');\nconst _ = require('koa-route');\nconst Podlet = require('@podium/podlet');\n\nconst app = Koa();\n\nconst podlet = new Podlet({\n    pathname: '/',\n    version: '2.0.0',\n    name: 'podletContent',\n});\n\napp.use(KoaPodlet(podlet));\n\nconst contentRoute = _.get(podlet.content(), async ctx =\u003e {\n    if (ctx.state.podium.context.locale === 'nb-NO') {\n        ctx.podiumSend('\u003ch2\u003eHei verden\u003c/h2\u003e');\n        return;\n    }\n    ctx.podiumSend('\u003ch2\u003eHello world\u003c/h2\u003e');\n});\n\napp.use(contentRoute);\n\nconst manifestRoute = _.get(podlet.manifest(), async ctx =\u003e {\n    ctx.body = podlet;\n});\n\napp.use(manifestRoute);\n\nconst start = () =\u003e {\n  try {\n    const server = app.listen(7100)\n    console.log(`server listening on ${server.address().port}`)\n  } catch (err) {\n    console.error(err)\n    process.exit(1)\n  }\n};\nstart();\n```\n\n## Register plugin\n\nThe middleware is registered by passing an instance of the [@podium/podlet] class\nto the middleware, and then registering that with Koa through `.use()`.\n\n```js\napp.use(KoaPodlet(podlet));\n```\n\n## Request params\n\nOn each request [@podium/podlet] will run a set of operations, such as\ndeserialization of the [@podium/context], on the request. When doing so\n[@podium/podlet] will write parameters to `ctx.state.podium` which is\naccessible inside a request handler.\n\n```js\nconst contentRoute = _.get(podlet.content(), async (ctx) =\u003e {\n    if (ctx.state.podium.context.locale === 'nb-NO') {\n        ctx.podiumSend('\u003ch2\u003eHei verden\u003c/h2\u003e');\n        return;\n    }\n    ctx.podiumSend('\u003ch2\u003eHello world\u003c/h2\u003e');\n});\napp.use(contentRoute);\n```\n\n## ctx.podiumSend(fragment)\n\nWhen in development mode this method will wrap the provided fragment in a\ndefault HTML document before dispatching. When not in development mode, this\nmethod will just dispatch the fragment.\n\nSee [development mode] for further information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpearofducks%2Fpodium-koa-podlet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpearofducks%2Fpodium-koa-podlet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpearofducks%2Fpodium-koa-podlet/lists"}