From 1ba9f28c847ba24bc7673f791288b1a7d0b366b0 Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Mon, 8 Mar 2021 17:10:19 +0000 Subject: [PATCH 1/4] docs(readme): spelling and grammar fixes --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index cd73866..8bc804e 100644 --- a/README.md +++ b/README.md @@ -4,16 +4,16 @@ ![CI workflow](https://github.com/fastify/fastify-postgres/workflows/CI%20workflow/badge.svg) -Fastify PostgreSQL connection plugin, with this you can share the same PostgreSQL connection pool in every part of your server. -Under the hood the [node-postgres](https://github.com/brianc/node-postgres) is used, the options that you pass to `register` will be passed to the PostgreSQL pool builder. +Fastify PostgreSQL connection plugin; with this, you can share the same PostgreSQL connection pool in every part of your server. +Under the hood [node-postgres](https://github.com/brianc/node-postgres) is used, the options that you pass to `register` will be passed to the PostgreSQL pool builder. ## Install ``` npm i pg fastify-postgres --save ``` ## Usage -Add it to you project with `register` and you are done! -This plugin will add the `pg` namespace in your Fastify instance, with the following properties: +Add it to your project with `register` and you are done! +This plugin will add the `pg` namespace to your Fastify instance, with the following properties: ``` connect: the function to get a connection from the pool pool: the pool instance @@ -145,7 +145,7 @@ fastify.listen(3000, err => { }) ``` -As you can see there is no need to close the client, since is done internally. Promises and async await are supported as well. +As you can see there is no need to close the client, since it is done internally. Promises and async await are supported as well. ### Name option If you need to have multiple databases set up, then you can name each one of them by passing `name: 'foo'`. It will then be accessible as `fastify.pg.foo`. @@ -175,9 +175,9 @@ fastify.listen(3000, err => { ``` ### Native option -If you want to gain the maximum performances you can install [pg-native](https://github.com/brianc/node-pg-native), and pass `native: true` to the plugin options. +If you want maximum performance you can install [pg-native](https://github.com/brianc/node-pg-native), and pass `native: true` to the plugin options. *Note: it requires PostgreSQL client libraries & tools installed, see [instructions](https://github.com/brianc/node-pg-native#install).* -Note: trying to use native options without successfully installation of `pg-native` will get a warning and fallback to regular `pg` module. +Note: trying to use native options without successfully installation of `pg-native` will return a warning and fallback to regular `pg` module. ```js const fastify = require('fastify')() @@ -231,7 +231,7 @@ fastify.listen(3000, err => { ``` ### Transact route option -It's possible to automatically wrap a route handler in a transaction by using the `transact` option when registering a route with Fastify. Note that the option must be scoped within a `pg` options object to take effect. +It is possible to automatically wrap a route handler in a transaction by using the `transact` option when registering a route with Fastify. Note that the option must be scoped within a `pg` options object to take effect. `query` commands can then be accessed at `request.pg` or `request.pg[name]` and `transact` can be set for either the root pg client with value `true` or for a pg client at a particular namespace with value `name`. Note that the namespace needs to be set when registering the plugin in order to be available on the request object. From d81d9cb77feb58a107e72c60f01df6a92400d7f6 Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Mon, 8 Mar 2021 17:10:30 +0000 Subject: [PATCH 2/4] docs(readme): add badges --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8bc804e..4d4e120 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ # fastify-postgres -[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/) -![CI -workflow](https://github.com/fastify/fastify-postgres/workflows/CI%20workflow/badge.svg) +![CI](https://github.com/fastify/fastify-postgres/workflows/CI%20workflow/badge.svg) +[![NPM version](https://img.shields.io/npm/v/fastify-postgres.svg?style=flat)](https://www.npmjs.com/package/fastify-postgres) +[![Known Vulnerabilities](https://snyk.io/test/github/fastify/fastify-postgres/badge.svg)](https://snyk.io/test/github/fastify/fastify-postgres) +[![Coverage Status](https://coveralls.io/repos/github/fastify/fastify-postgres/badge.svg?branch=master)](https://coveralls.io/github/fastify/fastify-postgres?branch=master) +[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://standardjs.com/) Fastify PostgreSQL connection plugin; with this, you can share the same PostgreSQL connection pool in every part of your server. Under the hood [node-postgres](https://github.com/brianc/node-postgres) is used, the options that you pass to `register` will be passed to the PostgreSQL pool builder. From 054860f3ef022b50af9fb16b44ad11edfb60faed Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Mon, 8 Mar 2021 17:10:48 +0000 Subject: [PATCH 3/4] docs(readme): upgrade http links to https --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4d4e120..1781748 100644 --- a/README.md +++ b/README.md @@ -307,8 +307,8 @@ $ npm test ## Acknowledgements This project is kindly sponsored by: -- [nearForm](http://nearform.com) -- [LetzDoIt](http://www.letzdoitapp.com/) +- [nearForm](https://nearform.com) +- [LetzDoIt](https://www.letzdoitapp.com/) ## License From 772d06d3762275ae4d77915614f1bfc825ea6284 Mon Sep 17 00:00:00 2001 From: Frazer Smith <43814140+Fdawgs@users.noreply.github.com> Date: Mon, 8 Mar 2021 17:21:03 +0000 Subject: [PATCH 4/4] docs(readme): fix broken nearform link Co-authored-by: KaKa --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1781748..e0927db 100644 --- a/README.md +++ b/README.md @@ -307,7 +307,7 @@ $ npm test ## Acknowledgements This project is kindly sponsored by: -- [nearForm](https://nearform.com) +- [nearForm](https://www.nearform.com) - [LetzDoIt](https://www.letzdoitapp.com/) ## License