RenaiApp/src/main/services/database.ts

23 lines
480 B
TypeScript

import 'reflect-metadata';
import { Connection, createConnection } from 'typeorm';
let connection: Connection;
function init(): void {
initConnection();
}
function initConnection(): void {
// createConnection method will automatically read connection options
// from your ormconfig file or environment variables
createConnection('library')
.then((c: Connection) => {
connection = c;
})
.catch((reason: any) => {
throw reason;
});
}
init();