Setup for postgres database & schema for blogposts.

This commit is contained in:
2021-01-03 18:16:52 +01:00
parent 5b9d9aeca8
commit 3aef0862ec
8 changed files with 374 additions and 0 deletions

23
api/database/index.js Normal file
View File

@@ -0,0 +1,23 @@
const configuration = require(`${__base}/config/configuration`).getInstance();
const PostgresDatabase = require(`${__base}/database/postgres`);
const user = configuration.get("database", "user");
const password = configuration.get("database", "password");
const host = configuration.get("database", "host");
const dbName = configuration.get("database", "database");
let postgresDB = new PostgresDatabase(user, password, host, dbName);
postgresDB.connect();
class Database {
};
Database.connect = () => postgresDB.connect();
Database.query = (sql, values) => postgresDB.query(sql, values);
Database.update = (sql, values) => postgresDB.update(sql, values);
Database.get = (sql, values) => postgresDB.get(sql, values);
Database.all = (sql, values) => postgresDB.all(sql, values);
module.exports = Database;