diff options
Diffstat (limited to 'src/start.ts')
-rwxr-xr-x | src/start.ts | 25 |
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}` + ); +}); |