{"id":22984623,"url":"https://github.com/doron2402/hapi-pg","last_synced_at":"2026-04-16T19:36:24.258Z","repository":{"id":57261031,"uuid":"99848682","full_name":"doron2402/hapi-pg","owner":"doron2402","description":"Hapi.js plugin for postgres (Using PG 7.X.X)","archived":false,"fork":false,"pushed_at":"2021-11-24T11:54:46.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T10:44:50.755Z","etag":null,"topics":["hapi-pg","hapi-plugin","hapijs","nodejs","plugin","pool","postgres","register"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/doron2402.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-08-09T20:10:47.000Z","updated_at":"2021-11-24T11:54:49.000Z","dependencies_parsed_at":"2022-08-31T16:21:11.474Z","dependency_job_id":null,"html_url":"https://github.com/doron2402/hapi-pg","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/doron2402/hapi-pg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doron2402%2Fhapi-pg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doron2402%2Fhapi-pg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doron2402%2Fhapi-pg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doron2402%2Fhapi-pg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doron2402","download_url":"https://codeload.github.com/doron2402/hapi-pg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doron2402%2Fhapi-pg/sbom","scorecard":{"id":352731,"data":{"date":"2025-08-11","repo":{"name":"github.com/doron2402/hapi-pg","commit":"39a97fb4eb7f7b294049068b24a51998f2683a30"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.9,"checks":[{"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":"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":0,"reason":"Found 0/5 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":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"Token-Permissions","score":9,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql-analysis.yml:28","Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql-analysis.yml:29","Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1","Info: no jobLevel write permissions found"],"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/doron2402/hapi-pg/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:45: update your workflow using https://app.stepsecurity.io/secureworkflow/doron2402/hapi-pg/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/doron2402/hapi-pg/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:70: update your workflow using https://app.stepsecurity.io/secureworkflow/doron2402/hapi-pg/codeql-analysis.yml/master?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned"],"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":"SAST","score":10,"reason":"SAST tool detected: CodeQL","details":["Info: SAST configuration detected: CodeQL","Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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: Apache License 2.0: 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"}}]},"last_synced_at":"2025-08-18T08:44:22.967Z","repository_id":57261031,"created_at":"2025-08-18T08:44:22.967Z","updated_at":"2025-08-18T08:44:22.967Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279011445,"owners_count":26084947,"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-12T02:00:06.719Z","response_time":53,"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":["hapi-pg","hapi-plugin","hapijs","nodejs","plugin","pool","postgres","register"],"created_at":"2024-12-15T03:16:58.418Z","updated_at":"2025-10-12T13:35:43.337Z","avatar_url":"https://github.com/doron2402.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hapi-pg\nHapi.js plugin for postgres (Using PG 7.X.X)\n\n[![Build Status](https://travis-ci.org/doron2402/hapi-pg.svg?branch=master)](https://travis-ci.org/doron2402/hapi-pg)\n\n\n## Install\n\n```bash\n$ npm install hapi-plugin-pg\n```\n\n## Usage\n\n### Register\n- Register the plugin with username/password/host/port/database\n```js\nconst plugin = {\n  register: require('hapi-plugin-pg'),\n  options: {\n    user: 'username',\n    password: 'password',\n    port: 5432,\n    host: 'localhost',\n    database: 'test_db',\n    attach: 'onPreHandler', // Hapi.js events\n    detach: 'tail', // Hapi.js events\n  }\n};\n```\n- Register with connection String\n```js\nconst plugin = {\n  register: require('hapi-plugin-pg'),\n  options: {\n    connectionString: 'postgres://username:password@localhost/database',\n  }\n};\n```\n* Make sure to register the plugin with `connectionString` OR `user`/`password`/`host`/`port`/`database` not both! this will throw an error.\n* attach event will ask from the Postgres pool for a connection.\n* detach event will return the Postges connection to the pool.\n\n### Query\n- Using `request` object:\n```js\nrequest.pg.client.query(query, (err, result) =\u003e {\n  if (err) {\n    // do something\n  }\n  // result object\n});\n```\n- Using the `server` object:\n```js\nserver.plugins['hapi-plugin-pg'].pg.connect((err, client, done) =\u003e {\n  if (err) {\n    throw err\n  }\n  client.query('SELECT * FROM users WHERE id = $1', [1], (err, res) =\u003e {\n    done();\n\n    if (err) {\n      console.log(err.stack)\n    } else {\n      console.log(res.rows[0])\n    }\n  });\n});\n```\n\n## Example\n```js\nserver.route({\n  method: 'GET',\n  path: '/{name}',\n  config: {\n    handler: (request, reply) =\u003e {\n      // THIS IS ONLY EXAMPLE\n      // Make sure to validate your params\n      request.pg.client('SELECT * FROM users WHERE name = $1', [request.params.name], (err, res) =\u003e {\n        request.pg.done();\n        if (err) {\n          return reply(err).code(500);\n        }\n        if (!res) {\n          return reply('not found').code(404);\n        }\n        return reply(res).code(200);\n      });\n    }\n  }\n});\n```\n\n\n## Contribute\n\nFeel free to create a pr just make sure to add tests\n\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoron2402%2Fhapi-pg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoron2402%2Fhapi-pg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoron2402%2Fhapi-pg/lists"}