From 28c576d66c5f1fcf8f7c0ff5399e74f2f70fcfb0 Mon Sep 17 00:00:00 2001 From: Cemre Mengu Date: Mon, 3 Dec 2018 16:04:03 +0300 Subject: [PATCH] Update readme to fix code samples Based on #34 I think that was a no :) --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 08ceb40..202b633 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ transact: a utility to perform multiple queries _with_ a transaction Example: ```js -const fastify = require('fastify') +const fastify = require('fastify')() fastify.register(require('fastify-postgres'), { connectionString: 'postgres://postgres@localhost/postgres' @@ -54,7 +54,7 @@ fastify.listen(3000, err => { Async await is supported as well! ```js -const fastify = require('fastify') +const fastify = require('fastify')() fastify.register(require('fastify-postgres'), { connectionString: 'postgres://postgres@localhost/postgres' @@ -76,7 +76,7 @@ fastify.listen(3000, err => { ``` Use of `pg.query` ```js -const fastify = require('fastify') +const fastify = require('fastify')() fastify.register(require('fastify-postgres'), { connectionString: 'postgres://postgres@localhost/postgres' @@ -99,7 +99,7 @@ fastify.listen(3000, err => { Use of `pg.transact` ```js -const fastify = require('fastify') +const fastify = require('fastify')() fastify.register(require('fastify-postgres'), { connectionString: 'postgres://postgres@localhost/postgres' @@ -153,7 +153,7 @@ If you want to gain the maximum performances you can install [pg-native](https:/ Note: trying to use native options without successfully installation of `pg-native` will get a warning and fallback to regular `pg` module. ```js -const fastify = require('fastify') +const fastify = require('fastify')() fastify.register(require('fastify-postgres'), { connectionString: 'postgres://postgres@localhost/postgres', @@ -179,7 +179,7 @@ fastify.listen(3000, err => { If you want to provide your own `pg` module, for example to support packages like [`pg-range`](https://www.npmjs.com/package/pg-range), you can provide an optional `pg` option with the patched library to use: ```js -const fastify = require('fastify') +const fastify = require('fastify')() const pg = require("pg"); require("pg-range").install(pg)