blob: a6399acd443809b382ee25e9eb5972b8f64a912e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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}`,
);
});
|