{"id":15680337,"url":"https://github.com/sholladay/hapi-error-page","last_synced_at":"2025-05-07T11:14:13.883Z","repository":{"id":57260874,"uuid":"82580853","full_name":"sholladay/hapi-error-page","owner":"sholladay","description":"Friendly error pages for humans","archived":false,"fork":false,"pushed_at":"2020-02-26T19:38:23.000Z","size":87,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-27T04:02:55.178Z","etag":null,"topics":["error","hapi","plugin","template","views"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sholladay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"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":"2017-02-20T16:53:12.000Z","updated_at":"2020-09-27T17:04:58.000Z","dependencies_parsed_at":"2022-08-31T12:22:00.999Z","dependency_job_id":null,"html_url":"https://github.com/sholladay/hapi-error-page","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sholladay%2Fhapi-error-page","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sholladay%2Fhapi-error-page/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sholladay%2Fhapi-error-page/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sholladay%2Fhapi-error-page/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sholladay","download_url":"https://codeload.github.com/sholladay/hapi-error-page/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252632187,"owners_count":21779601,"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":["error","hapi","plugin","template","views"],"created_at":"2024-10-03T16:41:31.960Z","updated_at":"2025-05-07T11:14:13.863Z","avatar_url":"https://github.com/sholladay.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hapi-error-page [![Build status for hapi Error Page](https://travis-ci.com/sholladay/hapi-error-page.svg?branch=master \"Build Status\")](https://travis-ci.com/sholladay/hapi-error-page \"Builds\")\n\n\u003e Friendly error pages for humans\n\nThis [hapi](https://hapijs.com) plugin makes it easy to return beautiful HTML error pages to your users.\n\n## Why?\n\n - Errors in hapi are displayed as [JSON](https://json.org) by default.\n - JSON is good for machines but bad for people.\n - Works with AJAX / APIs (respects the [`Accept`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept) header).\n\n## Install\n\n```sh\nnpm install hapi-error-page\n```\n\n## Usage\n\nRegister the plugin on your server to enable friendly error pages.\n\n```js\nconst hapi = require('@hapi/hapi');\nconst vision = require('@hapi/vision');\nconst errorPage = require('hapi-error-page');\n\nconst server = hapi.server();\n\nconst init = async () =\u003e {\n    await server.register([vision, errorPage]);\n    server.views({\n        engines    : { html : handlebars },\n        relativeTo : __dirname,\n        path       : '.'\n    });\n    server.route({\n        method : 'GET',\n        path   : '/',\n        handler() {\n            throw new Error('uh oh');\n        }\n    });\n    await server.start();\n    console.log('Server ready:', server.info.uri);\n};\n\ninit();\n```\n\nVisiting the above route will return an HTML error page rendered by [Handlebars](https://github.com/wycats/handlebars.js/) from a view file named `error.html`. You can, of course, use other templating engines instead (see the [vision](https://github.com/hapijs/vision) documentation for details).\n\nPlease use [boom](https://github.com/hapijs/boom) to construct errors instead of `new Error()`, so that we can deliver more useful messages. This project will function correctly either way, but `boom` is preferred.\n\n## Contributing\n\nSee our [contributing guidelines](https://github.com/sholladay/hapi-error-page/blob/master/CONTRIBUTING.md \"Guidelines for participating in this project\") for more details.\n\n1. [Fork it](https://github.com/sholladay/hapi-error-page/fork).\n2. Make a feature branch: `git checkout -b my-new-feature`\n3. Commit your changes: `git commit -am 'Add some feature'`\n4. Push to the branch: `git push origin my-new-feature`\n5. [Submit a pull request](https://github.com/sholladay/hapi-error-page/compare \"Submit code to this project for review\").\n\n## License\n\n[MPL-2.0](https://github.com/sholladay/hapi-error-page/blob/master/LICENSE \"License for hapi-error-page\") © [Seth Holladay](https://seth-holladay.com \"Author of hapi-error-page\")\n\nGo make something, dang it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsholladay%2Fhapi-error-page","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsholladay%2Fhapi-error-page","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsholladay%2Fhapi-error-page/lists"}