GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - liviaerxin/hapi-postgres: Hapi postgres plugin for Hapijs that supports multiple connections, inspired by Marsup/hapi-mongodb

BranchesTags
Open more actions menu

Latest commit

 

History

11 Commits
11 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
example
example
 
 
lib
lib
 
 
test
test
 
 
.gitignore
.gitignore
 
 
.prettierrc
.prettierrc
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
tsconfig.json
tsconfig.json
 
 
tsconfig.release.json
tsconfig.release.json
 
 

Repository files navigation

Hapi-Postgres

This is a plugin to expose a shared PostgreSQL connection pool across the whole Hapi server and each request.

It helps developers to concentrate on query() operation, reducing the burden to control connect() and end() operations before and after each query().

Getting Started

Options

  • settings: Optional. Provide settings to the connection. If you not configure it, most of settings will be initialized from your environment variables in default, See all supported at https://node-postgres.com/apis/client#new-client and https://node-postgres.com/apis/pool#new-pool.
  • decorate: Optional. Rather have exposed objects accessible through server and request decorations. You cannot mix different types of decorations.
    • If true, server.pg or request.pg
    • If it's a string, server.<string> or request.<string>

Several objects are exposed by this plugin:

  • client: The single client of postgresql, an instance of pg.Client
  • pool: The connection of pool of postgresql, an instance of pg.Pool
  • lib: node-postgre library

Example

Test

node --watch server.js
node --watch-path=./src server.js
GET http://127.0.0.1:4000 HTTP/1.1
GET http://127.0.0.1:4000/test HTTP/1.1
docker run -it --rm \
    -e POSTGRES_USER=postgres \
    -e POSTGRES_PASSWORD=mysecretpassword \
    -e POSTGRES_DB=db \
    -p 5432:5432 \
    postgres

Compatibility level

Ships with mongodb 3.x.

References

About

Hapi postgres plugin for Hapijs that supports multiple connections, inspired by Marsup/hapi-mongodb

Resources

Readme
MIT license

Code of conduct

Code of conduct
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.