app.js 877 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";
13
import locCodeRouter from "./routers/locCodeRouter";
KangMin An's avatar
KangMin An committed
14
15
16

const app = express();

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

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

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

// router 사용
KangMin An's avatar
KangMin An committed
31
app.use(routes.home, globalRouter);
32
app.use(routes.data, dataRouter);
33
app.use(routes.locCode, locCodeRouter);
KangMin An's avatar
KangMin An committed
34
35

export default app;