Databases
PostgreSQL
Provision and connect to a managed PostgreSQL database on OneBit Deploy.
PostgreSQL is a powerful open-source relational database and a great default choice for most applications.
Create a PostgreSQL database
On Apps, press Add app → Add database, choose PostgreSQL, give it a Name and press Create database. Once it's ready, OneBit shows the connection details on the database's page.
Connection string
A PostgreSQL connection string looks like this:
postgres://USER:PASSWORD@HOST:PORT/DATABASECopy it from the database's page into your app's Environment (for
example DATABASE_URL). See Connecting to a database.
Connecting from Node.js
import { Pool } from 'pg';
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
const { rows } = await pool.query('select now()');
console.log(rows[0]);Keep the connection string secret. Store it as an environment variable rather than in your code or repository.