-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
31 lines (24 loc) · 800 Bytes
/
index.ts
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
26
27
28
29
30
31
import appExp from "./app.js";
import configuration from "./config/config.js";
import mongoose from "mongoose";
let mongoURI: string = configuration.MONGO_URL
? configuration.MONGO_URL
: `mongodb://${configuration.MONGO_USER}:${configuration.MONGO_PASSWORD}@${configuration.MONGO_IP}:${configuration.MONGO_PORT}/${configuration.MONGO_DB}?authSource=admin`;
const connectToMongoDB = () => {
mongoose
.connect(mongoURI)
.then(() => {
console.log("Mongo-DB Connected.");
})
.catch((err) => {
console.log(err);
});
};
const port = configuration.PORT;
connectToMongoDB();
appExp.listen(port, () => {
console.log(`Example app listening on port http://localhost:${port}`);
});
// TODO:
// Handle Payment DB in Order and Create Payment
// Handle it in frontend