-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
32 lines (27 loc) · 979 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
32
import dotenv from "dotenv"
import express from "express"
import cors from "cors"
import connectToDatabase from "./database/connection.js"
import userRouter from "./routes/userRoutes.js"
import researchProposalRouter from "./routes/researchProposalRoutes.js"
import plagiarismRouter from "./routes/plagiarismRoutes.js"
import fundingRouter from "./routes/fundingRoutes.js"
import expertRouter from "./routes/expertRoutes.js"
const app = express()
dotenv.config()
const port = 3000 || process.env.PORT
app.use(cors())
app.use(express.json())
app.use(express.urlencoded({ extended: true }))
connectToDatabase()
app.get('/', (req, res) => {
res.send('Welcome to SIH Backend API.')
})
app.use('/api/user', userRouter)
app.use('/api/proposal', researchProposalRouter)
app.use('/api/plagiarism', plagiarismRouter)
app.use('/api/funding', fundingRouter)
app.use('/api/expert', expertRouter)
app.listen(port, () => {
console.log(`Server listening on http://localhost:${port}`)
})