UNPKG

zents

Version:

ZenTS is a Node.js & TypeScript MVC-Framework for building rich web applications, released as free and open-source software under the MIT License. It is designed for building web applications with modern tools and design patterns.

25 lines 835 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createConnection = void 0; const config_1 = require("../config/config"); const FS_1 = require("../filesystem/FS"); const path_1 = require("path"); const typeorm_1 = require("typeorm"); async function createConnection() { if (!config_1.config.database.enable) { return null; } let connection; try { const options = Object.assign({}, config_1.config.database, { entities: [path_1.join(FS_1.fs.resolveZenPath('entity'), `*${FS_1.fs.resolveZenFileExtension()}`)], }); connection = await typeorm_1.createConnection(options); } catch (e) { throw new Error(e); } return connection; } exports.createConnection = createConnection; //# sourceMappingURL=createConnection.js.map