forked from Ankan002/code-for-ukraine-backend-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
41 lines (33 loc) · 1.1 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
require('dotenv').config()
const express = require('express')
const cors = require('cors')
const fileUpload = require('express-fileupload')
const { connectToDB } = require('./config/dbConnect')
const authRoutes = require('./routes/auth')
const userRoutes = require('./routes/user')
const reportRoutes = require('./routes/report')
const azureFaceRoutes = require('./routes/azureFace')
const { cronCheckQueue } = require('./helpers/queueHelper')
const startServer = () => {
const app = express()
const PORT = process.env.PORT
connectToDB()
app.use(cors())
app.use(express.json())
app.use(fileUpload({
useTempFiles: true
}))
//sets up cron job to run every minute to check Face Verify queue
cronCheckQueue()
app.get('/', (req, res) => {
res.status(200).json({
message: 'Welcome to Code For Ukraine API'
})
})
app.use('/api', authRoutes)
app.use('/api', userRoutes)
app.use('/api', reportRoutes)
app.use('/api', azureFaceRoutes)
app.listen(PORT, () => console.log(`App is running at ${PORT}`))
}
module.exports = startServer