Package Exports
- @vercel/postgres
Readme
@vercel/postgres 🚧
A client that works with Vercel Postgres.
Quick Start
Install
npm install @vercel/postgresBasic Usage
Automatically Read Environment Variables
Default Export
import postgres from '@vercel/postgres';
await postgres.query('SELECT * from POSTS WHERE likes > 100;');Named Export
import { postgres } from '@vercel/postgres';
await postgres.query('SELECT * from POSTS WHERE likes > 100;');Set Connection String Manually
import { createClient } from '@vercel/postgres';
const postgres = createClient(process.env.SOME_POSTGRES_CONNECTION_STRING);
await postgres.query('SELECT * from POSTS WHERE likes > 100;');Parameterized Query
import { postgres } from '@vercel/postgres';
await postgres.query('SELECT * from POSTS WHERE author=$1;', ['rauchg']);Documentation
The @vercel/postgres package uses pg under the hood. For
more detailed documentation, checkout node-postgres.