{"id":31939055,"url":"https://github.com/felixheck/akaya","last_synced_at":"2025-10-14T08:20:58.236Z","repository":{"id":8951861,"uuid":"60349243","full_name":"felixheck/akaya","owner":"felixheck","description":"Generate URIs based on named hapi.js routes their parameters","archived":false,"fork":false,"pushed_at":"2023-02-13T05:03:50.000Z","size":547,"stargazers_count":14,"open_issues_count":4,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-01T10:54:31.811Z","etag":null,"topics":["akaya","hapi","hapi-server","uri"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/felixheck.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2016-06-03T13:20:34.000Z","updated_at":"2024-04-22T22:18:40.000Z","dependencies_parsed_at":"2024-06-19T03:03:44.435Z","dependency_job_id":"5b563808-edef-4ec9-a7fd-b5f7606cab49","html_url":"https://github.com/felixheck/akaya","commit_stats":null,"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"purl":"pkg:github/felixheck/akaya","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixheck%2Fakaya","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixheck%2Fakaya/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixheck%2Fakaya/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixheck%2Fakaya/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/felixheck","download_url":"https://codeload.github.com/felixheck/akaya/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixheck%2Fakaya/sbom","scorecard":{"id":396415,"data":{"date":"2025-08-11","repo":{"name":"github.com/felixheck/akaya","commit":"baa10b7a2388d97c28f76669e37f440504b76eeb"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 1/21 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 3-Clause \"New\" or \"Revised\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 10 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T19:07:14.402Z","repository_id":8951861,"created_at":"2025-08-18T19:07:14.403Z","updated_at":"2025-08-18T19:07:14.403Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018268,"owners_count":26086334,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["akaya","hapi","hapi-server","uri"],"created_at":"2025-10-14T08:20:34.836Z","updated_at":"2025-10-14T08:20:58.230Z","avatar_url":"https://github.com/felixheck.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![akaya](https://raw.githubusercontent.com/felixheck/akaya/master/assets/logo.png)\n\n# akaya\n#### Generate URIs based on named [hapi](https://github.com/hapijs/hapi) routes and their parameters\n\n[![Travis](https://img.shields.io/travis/felixheck/akaya.svg)](https://travis-ci.org/felixheck/akaya/builds/) ![node](https://img.shields.io/node/v/akaya.svg) ![npm](https://img.shields.io/npm/dt/akaya.svg) [![standard](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](http://standardjs.com/) ![npm](https://img.shields.io/npm/l/akaya.svg)\n---\n\n1. [Introduction](#introduction)\n2. [Installation](#installation)\n3. [Usage](#usage)\n4. [API](#api)\n5. [Example](#example)\n6. [Testing](#testing)\n7. [Contribution](#contribution)\n\n## Introduction\n\nThis [hapi](https://github.com/hapijs/hapi) plugin enables to generate URIs dynamically based on the `config.id` of a route and passed parameters. It supports mandatory, multiple and optionals parameters as well as wildcards. Because it is not necessary to hardcode the URIs, it supersedes further adjustments in the case of refactoring.\n\nThis plugin is based on a [hapi-to](https://github.com/mtharrison/hapi-to) fork but it is about 30x faster.\u003cbr/\u003e\nThe modules `standard` and `tape` are used to grant a high quality implementation.\u003cbr/\u003e\n\n#### Compatibility\n| Major Release | [hapi.js](https://github.com/hapijs/hapi) version | node version |\n| --- | --- | --- |\n| `v5` | `\u003e=18.4 @hapi/hapi` | `\u003e=12` |\n| `v4.1` | `\u003e=18.3.1 @hapi/hapi` | `\u003e=8` |\n| `v4` | `\u003e=18 hapi` | `\u003e=8` |\n| `v3` | `\u003e=17 hapi` | `\u003e=8` |\n| `v2` | `\u003e=13 hapi` | `\u003e=6` |\n\n## Installation\nFor installation use the [Node Package Manager](https://github.com/npm/npm):\n```\n$ npm install --save akaya\n```\n\nor clone the repository:\n```\n$ git clone https://github.com/felixheck/akaya\n```\n\n## Usage\n#### Change from `hapi-to` to `akaya`\nIf you want to change from `hapi-to` to `akaya` for performance reasons, just replace the `require` and use `request.aka` instead of `request.to`. Because the configuration is almost the same, the migration is seamless.\n\nIt just differs in the [configuration](#api) of `options.secure`. The value `\"match\"` is not available in `akaya`. The plugin matches the current request's connections protocol automatically as default.\n\nAdditionally parts of the functionality are exposed as server method.\n\n#### Import\nFirst you have to import the module:\n``` js\nconst akaya = require('akaya');\n```\n\n#### Create hapi server\nAfterwards create your hapi server if not already done:\n``` js\nconst hapi = require('@hapi/hapi');\nconst server = hapi.server({\n  port: 1337,\n  host: 'localhost',\n});\n```\n\n#### Registration\nFinally register the plugin per `server.register()`:\n``` js\n(async () =\u003e {\n  await server.register(akaya);\n  server.start();\n})();\n```\n\nAfter registering `akaya`, the [hapi request object](hapijs.com/api#request-object) and the [hapi server object](https://hapijs.com/api#server) will be decorated with the new methods `request.aka()` and `server.aka()`.\n\n## API\n`server.aka(id, [params], [options])`\n\nReturns an relative URI to a route\n- `id {string}` - required routes `config.id`.\n- `params`\n  - `query {Object.\u003c?string\u003e}` - Necessary query parameters, which will be stringified.\n  - `params {Object.\u003c?string\u003e}` - Necessary path parameters.\n- `options`\n  - `router {call}` - Set a custom [Call](https://github.com/hapijs/call) router\n\n`request.aka(id, [params], [options])`\n\nReturns an URI to a route\n- `id {string}` - see above\n- `params` – see above\n- `options`\n  - `router {call}` - Set a custom [Call](https://github.com/hapijs/call) router\n  - `rel {boolean}` - Whether to generate a relative URL. Default: `false`.\n  - `secure {boolean}` - If `true` the URL will be https, if `false` will be http. Default: match the `x-forwarded-proto` header or the current request's connection protocol.\n  - `host {string}` - Sets the host in the URL. Default: match the current request.\n\n## Example\n\n```js\nconst hapi = require('hapi');\nconst akaya = require('akaya');\n\nconst server = hapi.server({ port: 1337 });\n\nserver.route([{\n    method: 'GET',\n    path: '/',\n    handler (request, h) {\n        const url = request.aka('foo', {\n          params: { object: 'world' },\n          query: { page: '1' }\n        });\n\n        return h.redirect(url);\n    }\n}, {\n    method: 'GET',\n    path: '/multi',\n    handler (request, h) {\n        const url = request.aka('bar', {\n          params: { multi: [42, is, sense, of life] }\n        });\n\n        return h.redirect(url);\n    }\n}, {\n    method: 'GET',\n    path: '/hello/{object}',\n    config: {\n        id: 'foo',\n        handler (request) {\n          return 'No more redirects.';\n        }\n    }\n}, {\n    method: 'GET',\n    path: '/{multi*5}',\n    config: {\n        id: 'bar',\n        handler (request) {\n          return 'No more redirects.';\n        }\n    }\n}]);\n\n(async () =\u003e {\n  try {\n    await server.register(akaya);\n    await server.start();\n    console.log('Server started successfully');\n  } catch (err) {\n    console.error(err);\n  }\n})();\n```\n\nThe example above make use of redirects and `akaya`:\n\nThe route `http://localhost:1337/` will be redirected to `http://localhost:1337/hello/world?page=1`.\u003cbr/\u003e\nAnd the route `http://localhost:1337/multi` will be redirected to `http://localhost:1337/42/is/sense/of/life`.\n\n## Testing\nFirst you have to install all dependencies:\n```\n$ npm install\n```\n\nTo execute all unit tests once, use:\n```\n$ npm test\n```\n\nor to run tests based on file watcher, use:\n```\n$ npm start\n```\n\nTo get information about the test coverage, use:\n```\n$ npm run coverage\n```\n\n## Contribution\nFork this repository and push in your ideas.\n\nDo not forget to add corresponding tests to keep up 100% test coverage.\n\nIn case of questions or suggestions just open an issue.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelixheck%2Fakaya","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffelixheck%2Fakaya","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelixheck%2Fakaya/lists"}