added Model classes
This commit is contained in:
parent
fd257b335c
commit
6e8e0e0101
14 changed files with 145 additions and 33 deletions
24
backend/api/src/Database.ts
Normal file
24
backend/api/src/Database.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import pgPromise from "pg-promise";
|
||||
|
||||
|
||||
export abstract class Database {
|
||||
static db = null;
|
||||
get db() {
|
||||
if (Database.db == null) {
|
||||
Database.db = pgPromise({})('postgres://postgres:postgres@db:5432/rr')
|
||||
}
|
||||
return Database.db;
|
||||
}
|
||||
|
||||
static async catcher(request): Promise<any> {
|
||||
let data;
|
||||
try {
|
||||
data = await request();
|
||||
} catch (e) {
|
||||
console.log((e as Error).message)
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue