-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
32 lines (24 loc) · 849 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
const express = require("express");
const dotenv = require('dotenv');
const cors = require("cors");
const bodyParser = require('body-parser');
const { connectDB } = require("./config/conn");
const userRoutes = require("./routes/userRoutes");
const courseRoutes = require("./routes/courseRoutes");
const moduleRoutes = require("./routes/moduleRoutes");
dotenv.config();
const app = express();
connectDB();
app.use(cors());
app.use(express.json());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.set('view engine', 'ejs');
app.use("/api", userRoutes);
app.use("/api", courseRoutes);
app.use("/api", moduleRoutes);
app.get("/", (req, res) => {
res.send("<h1>Welcome to VidyaVault </h1>");
});
const port = process.env.PORT || 5000;
app.listen(port, () => console.log(`Server running on PORT ${port}`));