2019-06-22 18:52:24 +03:00
|
|
|
import { connect } from "../data/db";
|
2019-07-21 14:37:46 +03:00
|
|
|
import path from "path";
|
2019-05-26 00:13:42 +03:00
|
|
|
|
2019-11-08 00:03:02 +02:00
|
|
|
require("dotenv").config({ path: path.resolve(process.cwd(), "api.env") });
|
2019-07-22 00:11:24 +03:00
|
|
|
|
2019-08-04 15:45:35 +03:00
|
|
|
function errorHandler(err) {
|
2019-08-22 01:22:26 +03:00
|
|
|
console.error(err.stack || err); // tslint:disable-line:no-console
|
2019-08-04 15:45:35 +03:00
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
process.on("unhandledRejection", errorHandler);
|
|
|
|
|
2020-05-23 16:22:03 +03:00
|
|
|
// Connect to the database before loading the rest of the code (that depend on the database connection)
|
2019-08-22 01:22:26 +03:00
|
|
|
console.log("Connecting to database..."); // tslint:disable-line
|
2019-05-26 00:13:42 +03:00
|
|
|
connect().then(() => {
|
2020-05-23 16:22:03 +03:00
|
|
|
import("./start");
|
2019-05-26 00:13:42 +03:00
|
|
|
});
|