May 2017
Beginner to intermediate
328 pages
7h 17m
English
Before doing some more fancy stuff, we should learn how to talk to our PostgreSQL database. In order to do so, once an appropriate project is created, we need to install a DB client. I used node-PostgreSQL:
npm install pg --save
The code should be created in an index.js file:
const pg = require('pg'); //init client with the appropriate conn details const client = new pg.Client({ host: 'localhost', port: 5434, user: 'postgres', password: 'postgres', database: 'mastering_postgis' }); //connect ...Read now
Unlock full access