-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapp.js
52 lines (35 loc) · 1.21 KB
/
app.js
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
const express = require("express");
const { swaggerUi, specs } = require("./modules/swagger");
const app = express();
const cors = require("cors");
const port = 3000;
const user = require("./routes/user");
const article = require("./routes/article");
const comment = require("./routes/comment");
const image = require("./routes/image");
const category = require("./routes/category");
const businessCard = require("./routes/businessCard");
const cookieParser = require("cookie-parser");
const { verifyToken } = require("./routes/authorization");
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
let corsOptions = {
origin: "http://www.redesigninsta.kro.kr",
credentials: true,
};
app.use(cors(corsOptions));
app.use("/auth", user);
app.use("/article", verifyToken, article);
app.use("/comment", verifyToken, comment);
app.use("/image", verifyToken, image);
app.use("/businessCard", businessCard);
app.use("/category", verifyToken, category);
// API Server Docs
app.use("/api-docs", swaggerUi.serve, swaggerUi.setup(specs));
app.get("/", (req, res) => {
res.send("aa");
});
app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`);
});