-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
46 lines (30 loc) · 1.03 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
const express = require("express");
const app = express();
const mongoose = require("mongoose");
const cors = require('cors');
app.use(cors({
origin: '*',
methods: ['GET','POST','DELETE','UPDATE','PUT','PATCH']
}));
const authRoute = require("./routes/auth");
//Connect to DB
// mongoose.connect(
// 'mongodb://localhost:27017/donate',
// {
// useNewUrlParser: true,
// useUnifiedTopology: true,
// useFindAndModify: false,
// useCreateIndex: true,
// },
// () => {
// console.log("DB connected");
// }
// );
mongoose.connect('mongodb://vaideesh:[email protected]:27017,cluster0-shard-00-01.in4ky.mongodb.net:27017,cluster0-shard-00-02.in4ky.mongodb.net:27017/systemDB?ssl=true&replicaSet=atlas-n0eu9o-shard-0&authSource=admin&retryWrites=true&w=majority')
// // //Middlewares
app.use(express.json());
// // //Routes Middleware
app.use("/api/auth", authRoute);
app.listen(7000, function () {
console.log("Server is running on port 7000");
});