-
Notifications
You must be signed in to change notification settings - Fork 14
/
app.ts
52 lines (44 loc) · 1.48 KB
/
app.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import express, { Application, Request, Response } from "express";
import bodyParser from "body-parser";
import cors from "cors";
import loadEnvVariables from "./utils/envHelper";
import issueRoutes from "./routes/issue";
import issue_statusRoutes from "./routes/issue_status";
import sseRoutes from "./routes/sse";
import initializeFirebase from "./lib/firebase/initializeFirebase";
const createServer = (): express.Application => {
const app: Application = express();
// initialize environment variables
loadEnvVariables();
initializeFirebase();
// Body parsing Middleware
app.use(express.json({ limit: "50mb" }));
app.use(bodyParser.json());
app.use(express.urlencoded({ extended: true, limit: "50mb" }));
app.use(cors());
//Routes
app.use("/issueApis", issueRoutes);
app.use("/issueApis", issue_statusRoutes);
app.use("/issueApis", sseRoutes);
app.use(express.static("images"));
app.use("/issueApis/uploads", express.static("images"));
// eslint-disable-next-line no-unused-vars
app.get("/", async (_req: Request, res: Response): Promise<Response> => {
return res.status(200).send({
success: true,
message: "The IGM service is running",
});
});
// eslint-disable-next-line no-unused-vars
app.get(
"/health",
async (_req: Request, res: Response): Promise<Response> => {
return res.status(200).send({
success: true,
message: "The server is running",
});
}
);
return app;
};
export default createServer;