-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
31 lines (25 loc) · 907 Bytes
/
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
import express from 'express'
import connetcDatabase from './src/database/db.js'
import dotenv from "dotenv" //chama a blibioteca
import cors from 'cors'
import bodyParser from 'body-parser'
const app = express()
app.use(bodyParser.json({ limit: '50mb' }))
app.use(bodyParser.urlencoded({ limit: '50mb', extended: true }))
//import de toda rota do programa
import userRoute from './src/routes/user.route.js'
import authRoute from './src/routes/auth.route.js'
import newsRoute from './src/routes/news.route.js'
import swaggerRoute from './src/routes/swagger.route.js'
app.use(cors())
dotenv.config()
const port = process.env.PORT || 3000
connetcDatabase() //executa a função de conexão ao banco
app.use(express.json())
app.use('/users', userRoute)
app.use('/auth', authRoute)
app.use('/news', newsRoute)
app.use('/doc', swaggerRoute)
app.listen(port, () => {
console.log('server running')
})