2019-06-23 02:30:24 +02:00
|
|
|
import 'reflect-metadata';
|
|
|
|
import { Connection, createConnection } from 'typeorm';
|
|
|
|
|
2019-07-05 22:51:05 +02:00
|
|
|
export let library: Connection;
|
2019-06-23 02:30:24 +02:00
|
|
|
|
2019-06-30 01:18:21 +02:00
|
|
|
function init(): void {
|
2019-06-23 02:30:24 +02:00
|
|
|
initConnection();
|
|
|
|
}
|
|
|
|
|
|
|
|
function initConnection(): void {
|
|
|
|
// createConnection method will automatically read connection options
|
|
|
|
// from your ormconfig file or environment variables
|
|
|
|
createConnection('library')
|
2019-06-30 01:18:21 +02:00
|
|
|
.then((c: Connection) => {
|
2019-07-05 22:51:05 +02:00
|
|
|
library = c;
|
2019-06-23 02:30:24 +02:00
|
|
|
})
|
2019-06-30 01:18:21 +02:00
|
|
|
.catch((reason: any) => {
|
2019-06-23 02:30:24 +02:00
|
|
|
throw reason;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
init();
|