-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.ts
37 lines (27 loc) · 980 Bytes
/
app.ts
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
import express from 'express'
import dotenv from 'dotenv'
dotenv.config()
import { validationError, unknownError } from './middlewares/error.middleware'
import authMiddleware from './middlewares/auth.middleware'
import swaggerDocs from './utils/helpers/swagger.helper'
import auth from './routes/auth.routes'
import board from './routes/board.routes'
import card from './routes/card.routes'
import group from './routes/group.routes'
import { connectToDb } from './databases/index'
const app = express()
app.use(express.json())
app.use(express.urlencoded({ extended: false }))
app.use('/auth', auth)
app.use('/board', board)
app.use('/card', card)
app.use('/group', group)
swaggerDocs(app, parseInt(process.env.port as string))
app.use(validationError)
app.use(unknownError)
app.use(authMiddleware)
app.listen(process.env.port, async () => {
await connectToDb().then(async () => {
console.log(`http://127.0.0.1:${process.env.port || 1708} is listening...`)
})
})