{"id":13836145,"url":"https://github.com/hemerajs/fastify-hemera","last_synced_at":"2025-04-12T02:33:13.788Z","repository":{"id":25699726,"uuid":"104560408","full_name":"hemerajs/fastify-hemera","owner":"hemerajs","description":"Fastify plugin to integrate Hemera","archived":false,"fork":false,"pushed_at":"2023-01-06T13:28:56.000Z","size":694,"stargazers_count":12,"open_issues_count":15,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-12T02:32:55.029Z","etag":null,"topics":["api-gateway","fastify","fastifyjs-plugin","hemera"],"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/hemerajs.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":"2017-09-23T10:44:15.000Z","updated_at":"2023-04-07T02:13:49.000Z","dependencies_parsed_at":"2023-01-14T03:11:41.298Z","dependency_job_id":null,"html_url":"https://github.com/hemerajs/fastify-hemera","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/hemerajs%2Ffastify-hemera","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hemerajs%2Ffastify-hemera/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hemerajs%2Ffastify-hemera/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hemerajs%2Ffastify-hemera/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hemerajs","download_url":"https://codeload.github.com/hemerajs/fastify-hemera/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248506936,"owners_count":21115512,"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":["api-gateway","fastify","fastifyjs-plugin","hemera"],"created_at":"2024-08-04T15:00:36.712Z","updated_at":"2025-04-12T02:33:13.771Z","avatar_url":"https://github.com/hemerajs.png","language":"JavaScript","readme":"# fastify-hemera\n\n[![Build Status](https://travis-ci.org/hemerajs/fastify-hemera.svg?branch=master)](https://travis-ci.org/hemerajs/fastify-hemera)\n[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](#badge)\n[![NPM version](https://img.shields.io/npm/v/fastify-hemera.svg?style=flat)](https://www.npmjs.com/package/fastify-hemera)\n\n[Fastify](https://github.com/fastify/fastify) plugin to integrate [Hemera](https://github.com/hemerajs/hemera)\n\n## Install\n\n```bash\nnpm install --save fastify-hemera\n```\n\n## Register plugin\n\n```js\nfastify.register(require('fastify-hemera'), {\n  plugins: [require('hemera-mongo-store')],\n  hemera: {\n    name: 'test',\n    logLevel: 'debug'\n  },\n  nats: 'nats://localhost:4242'\n})\n```\n\nFull list of [hemera plugins](https://github.com/hemerajs/hemera#packages)\n\n## Getting Started\n\n```bash\n$ docker-compose up\n$ node example.js\n$ curl http://localhost:3000/reply?a=33\u0026b=22\n```\n\n## Examples\n\nSimple\n\n```js\nfastify.route({\n  method: 'GET',\n  url: '/math/add',\n  handler: (req, reply) =\u003e {\n    reply.act({ topic: 'math', cmd: 'add', a: req.query.a, b: req.query.b })\n  }\n})\n```\n\nAsync / Await\n\n```js\nfastify.route({\n  method: 'GET',\n  url: '/math/add',\n  handler: async function (req, reply) {\n    let resp = await req.hemera.act({ topic: 'math', cmd: 'add', a: req.query.a, b: req.query.b })\n    // access result\n    resp.data\n    // retain parent context\n    resp = resp.context.act(...)\n  }\n})\n```\n\n## Test\n\nTestsuite makes use of [hemera-testsuite](https://github.com/hemerajs/hemera-testsuite), so your setup should meet it's prerequisits, esp.:\n\nA nats server must be installed on your machine [nats.io](https://nats.io/download/nats-io/nats-server/) and executable as `gnatsd`. So add `nats-server` as `gnatsd` to your `PATH` as alias, link whatever works. Check if it's available:\n\n```sh\n$ gnatsd --help\n\nUsage: nats-server [options]\n\n[...]\n```\n\nNow test should succeed by running:\n\n```sh\n$ yarn test\n```","funding_links":[],"categories":["\u003ch2 align=\"center\"\u003eAwesome Fastify\u003c/h2\u003e"],"sub_categories":["\u003ch2 align=\"center\"\u003eEcosystem\u003c/h2\u003e"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhemerajs%2Ffastify-hemera","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhemerajs%2Ffastify-hemera","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhemerajs%2Ffastify-hemera/lists"}