summaryrefslogtreecommitdiff
path: root/src/start.ts
diff options
context:
space:
mode:
authorRaphael Kabo <raphaelkabo@hey.com>2023-10-06 12:34:36 +0100
committerRaphael Kabo <raphaelkabo@hey.com>2023-10-06 12:34:36 +0100
commitf80e509895b7b2c1d716ac276977b7165a13c192 (patch)
tree58220155d7ccdd8e47fca8ab9df087af5b80cc2b /src/start.ts
parentbd9fb237fa5bcc076d4c6f3bf8ff748df63515e4 (diff)
Typescript migration
Diffstat (limited to 'src/start.ts')
-rwxr-xr-xsrc/start.ts25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/start.ts b/src/start.ts
new file mode 100755
index 0000000..fcdfaea
--- /dev/null
+++ b/src/start.ts
@@ -0,0 +1,25 @@
+import mongoose from "mongoose";
+import { getConfig } from "./lib/config.js";
+import app from "./app.js";
+
+const config = getConfig();
+
+mongoose.connect(config.database.mongodb_url, {
+ useNewUrlParser: true,
+ useUnifiedTopology: true,
+});
+mongoose.set("useCreateIndex", true);
+mongoose.Promise = global.Promise;
+mongoose.connection
+ .on("connected", () => {
+ console.log("Mongoose connection open!");
+ })
+ .on("error", (err: any) => {
+ console.log(`Connection error: ${err.message}`);
+ });
+
+const server = app.listen(config.general.port, () => {
+ console.log(
+ `Welcome to gathio! The app is now running on http://localhost:${config.general.port}`
+ );
+});