restructure repo, separate sample app from docker configs

This commit is contained in:
sid palas
2023-01-27 09:26:02 -05:00
parent dd5d7bff0b
commit 08510ae883
58 changed files with 645 additions and 12 deletions

View File

@ -0,0 +1,25 @@
const { Pool } = require('pg');
const pool = new Pool();
// the pool will emit an error on behalf of any idle clients
// it contains if a backend error or network partition happens
pool.on('error', (err, client) => {
console.error('Unexpected error on idle client', err);
process.exit(-1);
});
// async/await - check out a client
const getDateTime = async () => {
const client = await pool.connect();
try {
const res = await client.query('SELECT NOW() as now;');
return res.rows[0];
} catch (err) {
console.log(err.stack);
} finally {
client.release();
}
};
module.exports = { getDateTime };