Cloud Native Engineer at Container Solutions. Co-organizer of Kubernetes Community Days. Creator of Get Going With Kubernetes. Lead maintainer of OSS project markdown-badges. Writer and Speaker.
Note: You may want to use a connection pool if your application makes frequent calls. Thus, rather than using Client, you will want to use Pool. Please refer to the node-postgres docs for more information.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi @jupjup !
Thanks for stopping by.
It follows the same idea for connecting to a PostgreSQL database on DO.
Here's the difference:
npm install --save pg
Afterwards, you'll create a connection object and and execute queries.
So it will look like this:
Note: You may want to use a connection pool if your application makes frequent calls. Thus, rather than using
Client
, you will want to usePool
. Please refer to the node-postgres docs for more information.