{"id":15585648,"url":"https://github.com/icebob/moleculer-pattern","last_synced_at":"2025-03-29T08:45:45.080Z","repository":{"id":142600589,"uuid":"129228807","full_name":"icebob/moleculer-pattern","owner":"icebob","description":"[PoC] Pattern-matching middleware for Moleculer","archived":false,"fork":false,"pushed_at":"2018-05-21T09:44:40.000Z","size":76,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-03T23:35:04.033Z","etag":null,"topics":["moleculer","pattern-matching"],"latest_commit_sha":null,"homepage":"","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/icebob.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":"2018-04-12T09:42:47.000Z","updated_at":"2019-11-22T10:50:56.000Z","dependencies_parsed_at":"2023-03-19T00:04:21.006Z","dependency_job_id":null,"html_url":"https://github.com/icebob/moleculer-pattern","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icebob%2Fmoleculer-pattern","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icebob%2Fmoleculer-pattern/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icebob%2Fmoleculer-pattern/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icebob%2Fmoleculer-pattern/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icebob","download_url":"https://codeload.github.com/icebob/moleculer-pattern/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246162115,"owners_count":20733355,"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":["moleculer","pattern-matching"],"created_at":"2024-10-02T21:02:20.544Z","updated_at":"2025-03-29T08:45:45.072Z","avatar_url":"https://github.com/icebob.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pattern matching feature  [![NPM version](https://img.shields.io/npm/v/moleculer-pattern.svg)](https://www.npmjs.com/package/moleculer-pattern)\nIt is just a proof-of-concept middleware to monkey-patch Moleculer Broker in order to add pattern-matching routing for action calls.\n\n## Features\n\n## Install\n```\nnpm install icebob/moleculer-pattern\n```\n\n## Usage\n\n**Install middleware**\n```js\nconst { ServiceBroker } = require(\"moleculer\");\nconst PatternMiddleware\t= require(\"../../index\");\n\n// Create broker\nconst broker = new ServiceBroker({\n    logger: console,\n});\n\nbroker.use(PatternMiddleware(broker));\n```\n\n**Create service with patterns**\n```js\nbroker.createService({\n    name: \"a\",\n    actions: {\n        first: {\n            pattern: {\n                a: 0,\n                b: \"x\"\n            },\n            handler(ctx) {\n                return \"Hello ${ctx.params.name}\";\n            }\n        }\n    }\n});\n```\n\n**Call a service**\n```js\nconst res = await broker.act({ a: 0, b: \"x\", name: \"John\" });\nconsole.log(res); // \"Hello John\"\n```\n\n\n# Test\n```\n$ npm test\n```\n\nIn development with watching\n\n```\n$ npm run ci\n```\n\n# Contribution\nPlease send pull requests improving the usage and fixing bugs, improving documentation and providing better examples, or providing some testing, because these things are important.\n\n# License\nThe project is available under the [MIT license](https://tldrlegal.com/license/mit-license).\n\n# Contact\nCopyright (c) 2018 MoleculerJS\n\n[![@icebob](https://img.shields.io/badge/github-moleculerjs-green.svg)](https://github.com/moleculerjs) [![@icebob](https://img.shields.io/badge/twitter-Icebobcsi-blue.svg)](https://twitter.com/Icebobcsi)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficebob%2Fmoleculer-pattern","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficebob%2Fmoleculer-pattern","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficebob%2Fmoleculer-pattern/lists"}