1.0.6 • Published 3 years ago
pgweb-node v1.0.6
Pgweb Node
Run pgweb from NodeJS. Pgweb node bindings and automatic installer.
Programmatic Usage
npm install pgweb-node
const pgweb = require("pgweb-node");
const server = await pgweb.startServer({
// All the command line parameters that pgweb accepts
// https://github.com/sosedoff/pgweb/wiki/Usage
host: "localhost",
user: "postgres",
listen: 8081,
});
// Sometime later...
server.stop();
Command Line Usage
This is the same as installing pgweb.
npm install -g pgweb-node
# run pgweb on default 8081 port
pgweb --host localhost --user postgres
Motivation
This is useful for times when you want to run pgweb as part of your api server.
Pgweb is automatically downloaded for the target platform and initialized.