{"id":24383244,"url":"https://github.com/firstandthird/hapi-views","last_synced_at":"2026-04-24T17:06:25.919Z","repository":{"id":53673167,"uuid":"43013517","full_name":"firstandthird/hapi-views","owner":"firstandthird","description":"Hapi view plugin","archived":false,"fork":false,"pushed_at":"2021-03-19T19:42:51.000Z","size":172,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-09-21T04:11:00.220Z","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":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-23T16:36:12.000Z","updated_at":"2022-02-11T21:01:06.000Z","dependencies_parsed_at":"2022-09-13T03:31:15.683Z","dependency_job_id":null,"html_url":"https://github.com/firstandthird/hapi-views","commit_stats":null,"previous_names":[],"tags_count":54,"template":false,"template_full_name":null,"purl":"pkg:github/firstandthird/hapi-views","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstandthird%2Fhapi-views","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstandthird%2Fhapi-views/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstandthird%2Fhapi-views/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstandthird%2Fhapi-views/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/firstandthird","download_url":"https://codeload.github.com/firstandthird/hapi-views/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstandthird%2Fhapi-views/sbom","scorecard":{"id":401102,"data":{"date":"2025-08-11","repo":{"name":"github.com/firstandthird/hapi-views","commit":"228511731b73dd76bb1cf708853080e9af95e1f2"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.3,"checks":[{"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":"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":"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":"Code-Review","score":2,"reason":"Found 5/17 approved changesets -- score normalized to 2","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":"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":"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":"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":"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":"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: MIT 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 20 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-18T20:07:01.044Z","repository_id":53673167,"created_at":"2025-08-18T20:07:01.044Z","updated_at":"2025-08-18T20:07:01.044Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32232727,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"ssl_error","status_checked_at":"2026-04-24T13:21:15.005Z","response_time":64,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["hapi-plugin","hapi-v17"],"created_at":"2025-01-19T10:13:58.778Z","updated_at":"2026-04-24T17:06:25.899Z","avatar_url":"https://github.com/firstandthird.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hapi-views\n\n[![Build Status](https://travis-ci.org/firstandthird/hapi-views.svg?branch=master)](https://travis-ci.org/firstandthird/hapi-views)\n[![Coverage Status](https://coveralls.io/repos/github/firstandthird/hapi-views/badge.svg?branch=master)](https://coveralls.io/github/firstandthird/hapi-views?branch=master)\n\n`hapi-views` is a hapi plugin that lets you quickly create view routes. You use JSON (or YAML) to specify routes that can pull in dynamic data from any source, then use that data to render an HTML page.\n\n## Features\n\n* works with any Hapi-compatible view engine\n* define view routes with concise JSON config files instead of programming route handlers in filthy Javascript\n* specify dynamic JSON for your views with [varson](https://github.com/firstandthird/varson)\n* pull in data with Hapi server methods\n\n## Usage\n\n```js\nserver.method('getUserInfo', async(id) =\u003e {\n  const user = await fetch(id);\n  return user;\n});\nawait server.register({\n  plugin: require('hapi-views'),\n  options: {\n    routes: {\n      '/homepage/{userId}': {\n        view: 'homepage',\n        data: {\n          title: \"Your Homepage\",\n          amount: \"{{ 15 + 25 }}\",\n          userInfo: \"{{getUserInfo(request.params.userId)}}\"\n        }\n      }\n    }\n  }\n});\n```\n\n- For each key in _routes_, hapi-views will register a route handler matching that path.  The route will render the indicated _view_, passing _data_ as the context of the view.\n- hapi-views uses the [varson](https://github.com/firstandthird/varson) library to evaluate statements that appear in the double brackets.  Any method defined in _server.methods_ will be available from here and you can refer to the _request_ object in the method parameters, eg: _foo(request.params.userId)_ will work as expected from here.\n- passing '?debug=1' to a route will cause the server to log debug info as it renders the route\n\n## Route Options\n\n- __view__ (required)\n\n  The name of the view to render, the view must be available to the render engine you registered with hapi.\n\n- __data__ (required)\n\n  The data to pass to the rendering method\n\n- __groupedData__\n\n  An object containing additional data you can pass to the rendering method\n\n- __preProcess__\n\n  A method that takes in _(request, options, h)_ as parameters and is called after the request is processed, but before the view is returned,\n  you can use _preProcess_ to do any preprocessing you need\n\n- __preResponse__\n\n  A method that takes in a function that takes in _(request, options, h)_ as parameters and is called after the view has been rendered, but before it\n  is returned to the client\n\n- __onError__\n\n  A method that takes in _(err, h)_ as parameters and is called any time there is an error processing your route.  If _onError_ is defined then\n  whatever value it returns will be passed back to the client.\n\n\n## Top-Level Options\n\n- __globals__\n\n  An object that will be merged with the data field and passed to each render function.\n\n- __allowDebugJson__ (default is false)\n\n  When this is set to true, you can pass '?json=1' to a view route and it will\n  return the render data for the route instead of rendering the view\n\n## Example\n```javascript\nserver.method('getUserInfo', async(id) =\u003e {\n  const user = await db.users.findOne({ _id: id });\n  return user;\n});\n\nawait server.register({\n  plugin: require('hapi-views'),\n  options: {\n    globals: {\n      serverName: 'Bob the Server',\n      db: 'http://55.55.55.5555:2121/bobDb'\n    },\n    routes: {\n      '/homepage/{userId}': {\n        view: 'homepage',\n        data: {\n          title: \"Your Homepage\",\n          amount: \"{{ 15 + 25 }}\",\n          userInfo: \"{{getUserInfo(request.params.userId)}}\"\n        },\n        preProcess: (request, options, h) =\u003e {\n          request.server.log('Going to render the view');\n        },\n        preResponse: (request, options, h) =\u003e {\n          request.server.log('View has been rendered!');\n        },\n        onError: (err, h) =\u003e { return 'There was an error processing your request' }\n      }\n    }\n  }\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirstandthird%2Fhapi-views","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffirstandthird%2Fhapi-views","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirstandthird%2Fhapi-views/lists"}