-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
30 lines (26 loc) · 831 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
const express = require("express");
const mongoose = require("mongoose");
const authRouter = require("./route/auth");
const jobRouter = require("./route/job");
const cookieParser = require("cookie-parser");
const app = express();
app.use(express.json());
app.use(cookieParser());
mongoose
.connect(
"mongodb+srv://surendrasaluru:[email protected]/?retryWrites=true&w=majority&appName=Cluster0"
)
.then(() => {
console.log("database connected succesfully");
})
.catch((err) => {
console.log(err.message);
});
app.get("/health", async (req, res) => {
res.json({ message: " server is all going good", time: new Date() });
});
app.use("/api/v1/auth", authRouter);
app.use("/api/v1/job", jobRouter);
app.listen(7000, (req, res) => {
console.log("app is running on port 7000");
});