-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
25 lines (21 loc) · 725 Bytes
/
index.ts
File metadata and controls
25 lines (21 loc) · 725 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
import express, { Response } from 'express'
import routes from './router/routes'
import 'dotenv/config'
import cors from 'cors'
import cookieParser from 'cookie-parser'
import { Requests } from './utils/def'
import connectDB from './config/db'
connectDB()
const app = express()
app.use(cors())
app.use(express.urlencoded({ extended: false }))
app.use(express.json())
app.use(cookieParser())
app.use('/api', routes)
app.get('/', (req: Requests, res: Response): Response => {
return res.status(201).json({ msg: "Server is Live!!🚀" })
})
const port: number = Number(process.env.PORT) || 5000
app.listen(port, () => {
console.log(`Server is up and Running at http://localhost:${port}`)
})