RenaiApp/src/main/services/database.ts

23 lines
481 B
TypeScript
Raw Normal View History

import 'reflect-metadata';
import { Connection, createConnection } from 'typeorm';
export let library: Connection;
2019-06-30 01:18:21 +02:00
function init(): void {
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) => {
library = c;
})
2019-06-30 01:18:21 +02:00
.catch((reason: any) => {
throw reason;
});
}
init();