Registry / database / postgresws.server

postgresws.server

JSON →
library0.9.8jsnpmunverified

Postgres WebServices server for exposing PostgreSQL databases as web services via REST/WebSocket. Version 0.9.8 is the latest stable. Developed in Dogma and compiled to JavaScript. Suitable for building real-time data APIs directly from Postgres. No active releases since 2019; use at your own risk.

npm install postgresws.server
INSTALL
IMPORT
SIG · POSTGRESWS.SERVER
P
postgresws.server
databasejavascriptv0.9.8
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PostgresWS
✓ const PostgresWS = require('postgresws.server')
✗ import PostgresWS from 'postgresws.server'
Package is CJS-only. ESM import will fail.
ServerOptions
✓ // No type exports; configure via options object
✗ import { ServerOptions } from 'postgresws.server'
Types are not exported. Use JSDoc or inline configuration.
createServer
✓ const wsServer = require('postgresws.server').createServer({...})
✗ import { createServer } from 'postgresws.server'
No named exports. Use default or property access.

Creates a PostgresWS server with HTTP and WebSocket endpoints, configured via environment variables, and starts it.

const PostgresWS = require('postgresws.server'); const server = PostgresWS.createServer({ httpPort: 3000, wsPort: 3001, db: { host: process.env.PG_HOST || 'localhost', port: parseInt(process.env.PG_PORT) || 5432, user: process.env.PG_USER || 'postgres', password: process.env.PG_PASSWORD || '', database: process.env.PG_DATABASE || 'postgres' }, routes: { '/api/users': { query: 'SELECT * FROM users' } } }); server.start(err => { if (err) { console.error(err); process.exit(1); } console.log('PostgresWS server running'); });
Debug
Known issues
gotchaNo active development since 2019. Security vulnerabilities in dependencies may be unpatched.
fix
Evaluate if this package is still suitable. Consider alternatives like PostgREST or Hasura.
affects: >=0.0.0
gotchaPackage is CJS-only. ESM imports will throw an error.
fix
Use require() instead of import.
affects: >=0.0.0
gotchaNo TypeScript typings available. Type safety is not provided.
fix
Create custom type declarations or use JSDoc comments.
affects: >=0.0.0
gotchaPostgreSQL connection string must be configured via options object; no environment variable parsing built-in.
fix
Set db config properties explicitly from environment variables in your code.
affects: >=0.0.0
gotchaWebSocket server may conflict with existing WebSocket libraries if both are used in the same process.
fix
Ensure only one WebSocket server is running per port.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'postgresws.server'
Package not installed or imported incorrectly (ESM vs CJS).
fix
Run 'npm install postgresws.server' and use 'require()' instead of 'import'.
TypeError: PostgresWS.createServer is not a function
Incorrect import: using named import instead of default require.
fix
Use 'const PostgresWS = require('postgresws.server');' then 'PostgresWS.createServer()'.
Error: listen EADDRINUSE :::3000
Port already in use by another process.
fix
Change port via options or kill the process using the port.
error: relation "users" does not exist
SQL query references a table that does not exist.
fix
Check database schema and correct the route query.
Upgrade
Version history
0.9.8latest on npm
Audit
Dependencies
pgrequiredPostgreSQL client driver for database connections
wsrequiredWebSocket server for real-time communication
expressrequiredHTTP server framework for REST endpoints
Agent activity
8 hits · last 30 days
node
6
Resources
postgresws.server — npm install postgresws.server · libregistry