app.js 798 Bytes
Newer Older
KangMin An's avatar
KangMin An committed
1
2
3
4
5
6
import cookieParser from "cookie-parser";
import express from "express";
import morgan from "morgan";
import helmet from "helmet";
import path from "path";

7
8
import routes from "./routes";

KangMin An's avatar
KangMin An committed
9
import globalRouter from "./routers/globalRouter";
10
import dataRouter from "./routers/dataRouter";
KangMin An's avatar
KangMin An committed
11

12
import { localmiddleware } from "./middlewares";
KangMin An's avatar
KangMin An committed
13
14
15

const app = express();

16
// Page Views for Development test.
KangMin An's avatar
KangMin An committed
17
18
19
20
21
app.set("view engine", "pug");
app.set("views", path.join(__dirname, "views"));

app.use(helmet());
app.use(cookieParser());
22
23
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
KangMin An's avatar
KangMin An committed
24
25
app.use(morgan("dev"));

26
27
28
29
// local middleware 사용
app.use(localmiddleware);

// router 사용
30
31
app.use(routes.base, globalRouter);
app.use(routes.base + routes.data, dataRouter);
KangMin An's avatar
KangMin An committed
32
33

export default app;