{"id":24558202,"url":"https://github.com/rse/microkernel-mod-hapi","last_synced_at":"2025-04-19T09:59:08.956Z","repository":{"id":55108584,"uuid":"58884311","full_name":"rse/microkernel-mod-hapi","owner":"rse","description":"Microkernel module for integrating HAPI","archived":false,"fork":false,"pushed_at":"2021-01-09T23:07:34.000Z","size":62,"stargazers_count":0,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T21:55:48.298Z","etag":null,"topics":["hapi","microkernel","plugin"],"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/rse.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}},"created_at":"2016-05-15T21:04:55.000Z","updated_at":"2021-01-09T23:07:00.000Z","dependencies_parsed_at":"2022-08-14T12:10:55.467Z","dependency_job_id":null,"html_url":"https://github.com/rse/microkernel-mod-hapi","commit_stats":null,"previous_names":[],"tags_count":56,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Fmicrokernel-mod-hapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Fmicrokernel-mod-hapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Fmicrokernel-mod-hapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Fmicrokernel-mod-hapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rse","download_url":"https://codeload.github.com/rse/microkernel-mod-hapi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249670113,"owners_count":21308674,"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","microkernel","plugin"],"created_at":"2025-01-23T05:47:38.759Z","updated_at":"2025-04-19T09:59:08.937Z","avatar_url":"https://github.com/rse.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nmicrokernel-mod-hapi\n====================\n\nMicrokernel module for integrating HAPI.\n\n\u003cp/\u003e\n\u003cimg src=\"https://nodei.co/npm/microkernel-mod-hapi.png?downloads=true\u0026stars=true\" alt=\"\"/\u003e\n\n\u003cp/\u003e\n\u003cimg src=\"https://david-dm.org/rse/microkernel-mod-hapi.png\" alt=\"\"/\u003e\n\nAbout\n-----\n\nThis is an extension module for the\n[Microkernel](http://github.com/rse/microkernel) server\napplication environment, adding the capability to seamlessly\nintegrate the HAPI framework.\n\nUsage\n-----\n\n```shell\n$ npm install microkernel\n$ npm install microkernel-mod-ctx microkernel-mod-logger microkernel-mod-options\n$ npm install microkernel-mod-hapi\n```\n\n```js\nconst path = require(\"path\")\nconst Microkernel = require(\"microkernel\")\n\nconst kernel = new Microkernel()\n\nkernel.load(\"microkernel-mod-ctx\")\nkernel.load(\"microkernel-mod-options\")\nkernel.load(\"microkernel-mod-logger\")\nkernel.load([ path.join(__dirname, \"microkernel-mod-hapi.js\"), { websockets: true } ])\n\nkernel.add(class ExampleModule {\n    get module () {\n        return {\n            name:  \"example\",\n            after: [ \"HAPI\" ]\n        }\n    }\n    latch (mk) {\n        let uidir = path.join(mk.rs(\"ctx:basedir\"), \".\")\n        mk.latch(\"options:options\", (options) =\u003e {\n            options.push({\n                names: [ \"ui\" ], type: \"string\", \"default\": uidir,\n                help: \"user interface directory\", helpArg: \"DIR\" })\n        })\n    }\n    prepare (mk) {\n        /*  redirect top-level URL to UI  */\n        mk.rs(\"hapi\").route({\n            method: \"GET\",\n            path: \"/\",\n            handler: (request, h) =\u003e {\n                return h.redirect(\"ui/\")\n            }\n        })\n\n        /*  static delivery of the UI files  */\n        mk.rs(\"hapi\").route({\n            method: \"GET\",\n            path: \"/ui/{path*}\",\n            handler: {\n                directory: {\n                    path:  mk.rs(\"options:options\").ui,\n                    index: true,\n                    redirectToSlash: true\n                }\n            }\n        })\n    }\n})\n\nkernel.state(\"started\").then(() =\u003e {\n    kernel.publish(\"app:start:success\")\n}).catch((err) =\u003e {\n    kernel.publish(\"app:start:error\", err)\n})\n```\n\nLicense\n-------\n\nCopyright (c) 2016-2021 Dr. Ralf S. Engelschall (http://engelschall.com/)\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frse%2Fmicrokernel-mod-hapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frse%2Fmicrokernel-mod-hapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frse%2Fmicrokernel-mod-hapi/lists"}