-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
42 lines (30 loc) · 703 Bytes
/
app.js
File metadata and controls
42 lines (30 loc) · 703 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
33
34
35
36
37
38
39
//DB connection
const connectDB=require('./db/connect')
require("dotenv").config()
//imports
const express=require("express")
const app=express()
const router=require('./routes/route')
const notFound=require('./middleware/not_found')
//TaskModel
const Task=require('./models/Task')
//Json
app.use(express.json())
//Front
app.use(express.static('./public'))
//Router
app.use('/task',router)
//Non existant pages
// app.use(notFound)
//Server Port
const connect =async()=>{
try {
await connectDB(process.env.URI)
app.listen(5000,()=>{
console.log("Server Listening on port 5000...")
})
} catch (error) {
console.log(error)
}
}
connect()