forked from coders-garden/coders-garden-website-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.ts
38 lines (29 loc) · 813 Bytes
/
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
import "dotenv/config";
import express, { Express, Request, Response } from "express";
import cors from "cors";
import morgan from "morgan";
import ResponseHandler from "./components/responseHandler";
import membersRoute from "./routes/members";
import memberRoute from "./routes/member";
import graphqlRoute from "./routes/graphql";
import whoami from "./routes/whoami";
const corsOptions = {
origin: "*",
};
cors(corsOptions);
const app: Express = express();
app.use(cors());
app.use(morgan("dev"));
app.get("/", (req: Request, res: Response) => {
return ResponseHandler.success({
req,
res,
data: "Hello World",
message: "Success",
});
});
app.use("/member", memberRoute);
app.use("/members", membersRoute);
app.use("/graphql", graphqlRoute);
app.use("/whoami", whoami);
export default app;