-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
38 lines (26 loc) · 777 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
33
34
35
36
37
38
const express = require("express")
const dotenv = require("dotenv").config()
const connectDB = require("./config/db")
const authRoutes = require("./routes/authRoutes")
const cookieParser = require("cookie-parser")
const app = express();
app.use(express.json());
app.use(cookieParser());
const PORT = process.env.PORT || 8000
//function to connect to DB
connectDB()
//mongoose.connect(process.env.MONGODB_URL)
//.then (()=>{
//console.log("mongodb connected");
//})
//.catch((error)=>{
//console.log("error");
//})
app.listen(PORT, () => (
console.log(`Server running on ${PORT}`)
))
app.get("/", (req, res) => {
return res.status(200).json({ message: "Welcome to my school E-learning Platform" })
})
// Routes for Users
app.use("/api/v1/users", authRoutes);