A PSQL webapp
This is an Express app that will allow implement a PSQL like query tool in your browser.
It looks like this:
Install
Just:
npm install psql-web-app
How to use it
In your Express app, you need something like:
const express = ;const psqlWebApp = ;const Pool = ; const pool = databaseConfig; // your own db connection detailsconst app = ; app { let client = await pool; let result = await client; return result;}; psqlWebApp;
in other words you need to implement a query
function which will
return a result-set; the function needs to be added to the app
object which psqlWebApp.init
receives.
See here for details
on the databaseConfig
for the pg
library.
Options
You can also pass in a middleware function to be added to all the routes handlers for the PSQL web app so that you can use authentication or such like.
Like so:
psqlWebApp;
The middleware functions must be valid Express middleware.
If you want a list of middleware you'll need to implement that yourself, within a single middleware.