{"id":24383254,"url":"https://github.com/firstandthird/hapi-method-events","last_synced_at":"2025-12-26T06:49:53.503Z","repository":{"id":54297427,"uuid":"115482715","full_name":"firstandthird/hapi-method-events","owner":"firstandthird","description":"Hapi plugin to execute a method when an event fires","archived":false,"fork":false,"pushed_at":"2021-02-25T22:16:39.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-04T09:40:25.189Z","etag":null,"topics":["hapi-plugin","hapi-v17"],"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/firstandthird.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-12-27T04:52:45.000Z","updated_at":"2021-02-25T22:16:39.000Z","dependencies_parsed_at":"2022-08-13T11:20:25.001Z","dependency_job_id":null,"html_url":"https://github.com/firstandthird/hapi-method-events","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstandthird%2Fhapi-method-events","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstandthird%2Fhapi-method-events/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstandthird%2Fhapi-method-events/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstandthird%2Fhapi-method-events/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/firstandthird","download_url":"https://codeload.github.com/firstandthird/hapi-method-events/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243258504,"owners_count":20262301,"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":["hapi-plugin","hapi-v17"],"created_at":"2025-01-19T10:14:01.180Z","updated_at":"2025-12-26T06:49:53.453Z","avatar_url":"https://github.com/firstandthird.png","language":"JavaScript","readme":"# hapi-method-events\n\nA [hapi](https://hapi.dev/) plugin that makes it easy to create\nresponse handlers for server events\n\n## Installation\n\n```console\nnpm install hapi-method-events\n```\n\n## Usage\n\n\n```javascript\nconst plugin = require('hapi-method-events');\nconst server = new hapi.Server({ });\n\n// create a server event:\nserver.event('user.add');\n\n// create one or more server methods to respond to the event:\nserver.method('userAddHandler', (string) =\u003e {\n  console.log(string);\n});\nserver.method('anotherUserAddHandler', (data) =\u003e {\n  console.log(data.string2);\n});\n\n// register the plugin and specify server methods to call\n// in the 'events' field\nawait server.register({\n  plugin,\n  options: {\n    events: [{\n      event: 'user.add',\n      // notice that the method is specified as a string\n      // and you can choose what value to pass to it\n      // when the event is emitted:\n      method: 'userAddHandler(data.string1)'\n    },\n    {\n      event: 'user.add',\n      method: 'anotherUserAddHandler(data)'\n    }]\n  }\n});\n\n// now call the event!\nawait server.events.emit('user.add', {\n  data: {\n    string1: 'Hello World!',\n    string2: 'Hello Again!'\n  }\n});\n```\n\n## Options\n\n- __events__ (required)\n\nA list of events and methods to call for those events.  The events should be specified as string.\n\n- __verbose__\n\nIn verbose mode, hapi-method-events will print out the events and command string being executed.\nBy default this is set to false.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirstandthird%2Fhapi-method-events","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffirstandthird%2Fhapi-method-events","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirstandthird%2Fhapi-method-events/lists"}