-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
44 lines (36 loc) · 1.07 KB
/
app.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
39
40
41
42
43
44
const express = require("express");
const cors = require("cors");
const mongoose = require("mongoose");
const port = process.env.PORT || 5000;
const OrderRoutes = require("./routes/order");
const GetDetailsRoutes = require("./routes/get_userdetails");
// const jwt = require("jsonwebtoken");
const jwt = require("jsonwebtoken");
const app = express();
const db =
"mongodb+srv://mukesh:[email protected]/mylaundry?retryWrites=true&w=majority";
mongoose
.connect(db, {
useNewUrlParser: true,
useUnifiedTopology: true,
})
.then(() => {
console.log("MongoDB Connection Successful");
})
.catch((err) => {
console.log("MongoDB Connection Error", err);
});
app.use(cors());
require("./models/user");
require("./models/order");
app.use(express.json());
app.use(require("./routes/auth"));
app.use("/orders", OrderRoutes);
app.use("/get", GetDetailsRoutes);
app.use(cors());
require("./models/user");
app.use(express.json());
app.use(require("./routes/auth"));
app.listen(port, () => {
console.log(`Server is running on Port :: ${port}`);
});