-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
32 lines (24 loc) · 773 Bytes
/
server.js
File metadata and controls
32 lines (24 loc) · 773 Bytes
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 express from 'express'
import dotenv from 'dotenv'
import colors from 'colors'
import cors from 'cors'
import morgan from 'morgan'
import connectDB from './config/db.js'
import testroutes from './routes/testroutes.js'
import authroutes from './routes/authroutes.js'
import errormiddlewre from './middlewares/errormiddleware.js'
import jobroutes from './routes/jobsroute.js'
dotenv.config()
connectDB();
const app = express()
const port = process.env.PORT || 8080
app.use(express.json())
app.use(cors())
app.use(morgan("dev"))
app.use("/api/v1/test", testroutes)
app.use("/api/v1/auth", authroutes)
app.use("/api/v1/jobs", jobroutes)
app.use(errormiddlewre)
app.listen(port, () => {
console.log(`app listening on port ${port}!`.italic.brightMagenta)
})