-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathindex.ts
More file actions
34 lines (25 loc) · 757 Bytes
/
index.ts
File metadata and controls
34 lines (25 loc) · 757 Bytes
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
32
33
34
import express, { Application } from "express";
import { mainApp } from "./mainApp";
import dotenv from "dotenv";
import { db } from "./utils/dataBase";
dotenv.config();
const port: number = parseInt(process.env.APP_PORT!);
const app: Application = express();
mainApp(app);
const server = app.listen(process.env.PORT || port, () => {
console.log("");
console.log("server is ready to connect 🚀🚁🚀🚀");
db();
});
process.on("uncaughtException", (error: Error) => {
console.log("stop here: uncaughtException");
console.log(error);
process.exit(1);
});
process.on("unhandledRejection", (reason: any) => {
console.log("stop here: unhandledRejection");
console.log(reason);
server.close(() => {
process.exit(1);
});
});