{"id":15706685,"url":"https://github.com/transitive-bullshit/koa-micro","last_synced_at":"2025-05-12T19:02:07.835Z","repository":{"id":143882812,"uuid":"129979866","full_name":"transitive-bullshit/koa-micro","owner":"transitive-bullshit","description":"Koa 2 microservices with batteries included.","archived":false,"fork":false,"pushed_at":"2021-05-26T19:36:06.000Z","size":304,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-01T01:51:08.432Z","etag":null,"topics":["google-cloud-platform","koa","koa2","microservice","microservice-framework"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/transitive-bullshit.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2018-04-18T00:18:50.000Z","updated_at":"2023-08-01T03:47:23.000Z","dependencies_parsed_at":"2023-07-20T05:24:34.171Z","dependency_job_id":null,"html_url":"https://github.com/transitive-bullshit/koa-micro","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transitive-bullshit%2Fkoa-micro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transitive-bullshit%2Fkoa-micro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transitive-bullshit%2Fkoa-micro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transitive-bullshit%2Fkoa-micro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/transitive-bullshit","download_url":"https://codeload.github.com/transitive-bullshit/koa-micro/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253805850,"owners_count":21967052,"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":["google-cloud-platform","koa","koa2","microservice","microservice-framework"],"created_at":"2024-10-03T20:26:31.938Z","updated_at":"2025-05-12T19:02:07.749Z","avatar_url":"https://github.com/transitive-bullshit.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# koa-micro\n\n\u003e [Koa 2](http://koajs.com/) microservices with batteries included.\n\n[![NPM](https://img.shields.io/npm/v/koa-micro.svg)](https://www.npmjs.com/package/koa-micro) [![Build Status](https://travis-ci.com/transitive-bullshit/koa-micro.svg?branch=master)](https://travis-ci.com/transitive-bullshit/koa-micro) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n## Installation\n\n```\nnpm install --save koa-micro\n```\n\nThis module uses async await and therefore requires node \u003e= 8.\n\n## Usage\n\n```js\n'use strict'\n\n// ENV are set upstream at the container level\n// we set them here only for demo purposes\nprocess.env.APP_NAME = 'example-service'\nprocess.env.REVISION = 'example-revision'\n\nconst config = require('config')\nconst micro = require('koa-micro')\n\nconst app = micro()\n\napp.use(async (ctx, next) =\u003e {\n  ctx.body = config\n})\n\nconst port = process.env.PORT || 5000\nconst server = app.listen(port, () =\u003e {\n  micro.logger.info(`${process.env.APP_NAME}:${process.env.REVISION} up @ http://localhost:${port}`)\n})\n\nprocess.on('SIGINT', () =\u003e server.close())\n```\n\n### What's included\n\n  * Koa 2 app\n  * Context utility `assertFound`\n  * Context utility `assertParam`\n  * Context utility `success`\n  * Logger supporting [Google Cloud Trace](https://cloud.google.com/trace/)\n  * Error handler middleware with [Google Cloud Errors](https://cloud.google.com/error-reporting/)\n  * Access logs middleware\n  * Response time middleware\n  * CORS middleware\n  * OPTIONS middleware\n  * Gzip middleware\n  * Health check endpoint (`/alive` by default)\n\n### Usage \u0026 Configuration\n\nThis module uses [`config`](https://github.com/lorenwest/node-config) leveraging the [sub-module pattern](https://github.com/lorenwest/node-config/wiki/Sub-Module-Configuration). The base config is available at `./config` and can be overridden upstream by the actual service by simply adding values to the upstream configuration.\n\nThe resulting config will be the merged result of `Object.assign(micro-config, upstream-config)`.\n\n## License\n\nMIT © [Travis Fischer](https://github.com/transitive-bullshit)\n\nSupport my OSS work by \u003ca href=\"https://twitter.com/transitive_bs\"\u003efollowing me on twitter \u003cimg src=\"https://storage.googleapis.com/saasify-assets/twitter-logo.svg\" alt=\"twitter\" height=\"24px\" align=\"center\"\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftransitive-bullshit%2Fkoa-micro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftransitive-bullshit%2Fkoa-micro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftransitive-bullshit%2Fkoa-micro/lists"}