-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
35 lines (25 loc) · 799 Bytes
/
server.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
const express = require("express");
const app = express();
const PORT = process.env.PORT || 5000;
const dotenv = require("dotenv");
dotenv.config();
const { connectDB } = require("./config/db");
connectDB();
const path = require("path");
const cors = require("cors");
app.use(cors({ origin: "*" }));
app.use(express.json());
const userRoutes = require("./routes/userRoutes");
app.use("/api/user", userRoutes);
const taskRoutes = require("./routes/taskRoutes");
app.use("/api/task", taskRoutes);
app.get("/",(req,res)=>{
res.json({
message: "Server is Up"
});
})
setInterval(async()=>{
const res = await fetch("https://tasktrackerbackend-raao.onrender.com/");
console.log(res.message);
},14*60*1000);
app.listen(PORT, console.log(`Server Started on Port ${PORT}`));