mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 05:36:00 +00:00
context menu, editing connection
This commit is contained in:
10
api/src/engines/postgres/connect.js
Normal file
10
api/src/engines/postgres/connect.js
Normal file
@@ -0,0 +1,10 @@
|
||||
const { Client } = require('pg');
|
||||
|
||||
module.exports = async function connect({ server, port, user, password }) {
|
||||
const client = new Client({ host: server, port, user, password, database: 'postgres' });
|
||||
await client.connect();
|
||||
const res = await client.query('SELECT version()');
|
||||
const { version } = res.rows[0];
|
||||
await client.end();
|
||||
return { version };
|
||||
};
|
||||
Reference in New Issue
Block a user