-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.ts
More file actions
38 lines (34 loc) · 1.11 KB
/
index.ts
File metadata and controls
38 lines (34 loc) · 1.11 KB
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 { testPostgresConnection } from '#config/postgres'
import { testRedisConnection } from '#config/redis'
import globalExceptionHandler from '#error/globalExceptionHandler'
import { likeRouter } from '#like/router'
import { memberRouter } from '#member/router'
import { mockRouter } from '#mock/router'
import { noticeRouter } from '#notice/router'
import { rankRouter } from '#rank/router'
import cookieParser from 'cookie-parser'
import cors from 'cors'
import { configDotenv } from 'dotenv'
import express from 'express'
configDotenv()
const app = express()
const corsOptions = {
origin: 'http://dev.ai-rena.com',
method: ['GET', 'POST', 'PUT', 'DELETE', 'UPDATE'],
credentials: true,
preflightContinue: true,
}
app.use(cors(corsOptions))
app.use(cookieParser())
app.use(express.json())
app.use('/member', memberRouter)
app.use('/mock', mockRouter)
app.use('/notice', noticeRouter)
app.use('/like', likeRouter)
app.use('/rank', rankRouter)
app.use(globalExceptionHandler)
app.listen(3000, async () => {
await testPostgresConnection()
await testRedisConnection()
console.log('Server is running on port 3000')
})