1.0.3 • Published 9 months ago

hapi-postgres v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

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

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

1.0.3

9 months ago

1.0.2

9 years ago

1.0.1

9 years ago

2.0.0

9 years ago

1.0.0

9 years ago