-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
47 lines (29 loc) · 1.02 KB
/
index.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
const express = require("express")
const app = express()
app.use(express.json())
// =============== 라우터 =============
// const accountRouter = require("./src/router/account/account")
// app.use("/account", accountRouter)
const trackingRouter = require("./src/router/tracking/tracking")
app.use("/tracking", trackingRouter)
// const snsRouter = require("./src/router/sns/sns")
// app.use("/sns", snsRouter)
// const searchRouter = require("./src/router/search/search")
// app.use("/search", searchRouter)
// ============== 공통 에러 핸들러 ===========
app.use((err,req,res,next) => {
console.log("들어갑니다.")
console.error(err.stack)
res.status(err.status || 500).send({
"message" : err.message
})
})
app.use((req,res,next) => {
res.status(404).send({
"message" : "연결 실패"
})
})
// ===========================================
app.listen(8000, () => {
console.log("8000번 포트에서 웹 서버 실행")
})