Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Node Cookbook

You're reading from   Node Cookbook Actionable solutions for the full spectrum of Node.js 8 development

Arrow left icon
Product type Paperback
Published in Jul 2017
Publisher Packt
ISBN-13 9781785880087
Length 656 pages
Edition 3rd Edition
Languages
Tools
Arrow right icon
Authors (4):
Arrow left icon
Matteo Collina Matteo Collina
Author Profile Icon Matteo Collina
Matteo Collina
David Mark Clements David Mark Clements
Author Profile Icon David Mark Clements
David Mark Clements
Peter Elger Peter Elger
Author Profile Icon Peter Elger
Peter Elger
Mathias Buus Madsen Mathias Buus Madsen
Author Profile Icon Mathias Buus Madsen
Mathias Buus Madsen
Arrow right icon
View More author details
Toc

Table of Contents (20) Chapters Close

Title Page
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Customer Feedback
About nearForm
Preface
1. Debugging process* FREE CHAPTER 2. Writing Modules 3. Coordinating I/O 4. Using Streams 5. Wielding Web Protocols 6. Persisting to Databases 7. Working with Web Frameworks 8. Dealing with Security 9. Optimizing Performance 10. Building Microservice Systems 11. Deploying Node.js

Connecting and sending SQL to a Postgres server


Postgres an object-relational database. It gives everything that MySQL does, along enhanced commands and ability to store and query object data. This allows us to use the same database for both relational and document type data.

In this recipe, we're going to implement the same quotes application as we did in the previous recipe. In the There's more... section, we'll explore Postgres' additional object storage capability.

Getting ready

We'll need to install a Postgres server.

On Mac OS, we can use Homebrew (http://brew.sh):

$ brew install postgres

For Windows systems, we download a GUI installer from https://www.postgresql.org/download/windows/.

For Linux systems, we can obtain appropriate package from https://www.postgresql.org/download/linux/.

Once installed (and started) we'll want to create a database named after our system username.

After installation, in the usual command terminal, run the following:

$ createdb `whoami`

Once we have Postgres...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime
Visually different images