Connecting via Node.js

First, install node-postgres for your node project.

npm install pg

Then sign in to and click "Connect" to get your connection info.

Using that information, you can connect to and query your databases or public databases hosted on Try copying the code below and swapping out the connection information.

const { Client } = require('pg');

// Create a client using the connection information provided on
const client = new Client({
    user: 'GettingStarted',
    host: '',
    database: 'dliden/2020_Census_Reapportionment', // public database 
    password: '<bitio_key>', // key from database page connect menu
    port: 5432,
    ssl: true,

client.query('SELECT * FROM "dliden/2020_Census_Reapportionment"."Historical Apportionment" limit 10;', (err, res) => {
    console.table(res.rows); // you could also just console.log, but console.table is neat :)

Now run the program using node and you should see the rows you requested printed out in the console.

node main.js

Did this page help you?