Skip to content

alaisi/pegsocket.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

pegsocket.js - WebSocket driver for PostgreSQL

For making SQL queries directly from the browser to a pg database. Because why not!

Usage:

import pegsocket from './pegsocket.js'

const pg = await pegsocket({ url: 'ws://example.com:15432', database: 'web', user: 'browser' });
const result = await pg.query("select 'Hello ' || $1 || '!' msg", ['world']);
=> { rows:[{ msg: "Hello world!" }], updated: 0 }

PostgreSQL server configuration

  • Expose pg port as WebSocket endpoint with e.g., pg_websocket.
  • Configure scram-sha-256 or trust authentication for a db user in pg_hba.conf.

About

WebSocket driver for PostgreSQL

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published