-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
40 lines (28 loc) · 1.02 KB
/
server.js
File metadata and controls
40 lines (28 loc) · 1.02 KB
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
const express = require('express');
const mongoose = require('mongoose');
const bodyParser = require('body-parser');
const cors = require('cors');
const app = express();
//Import Routes
const postRoutes = require('./BackEnd/routes/UserProfile_Routes/posts');
//App middleware
app.use(bodyParser.json());
app.use(cors());
//Route middleware
app.use(postRoutes);
const PORT = 8000;
//const DB_URL = 'mongodb+srv://dthiwanka:dbpass112@cluster0.n4wch.mongodb.net/ProjectDatabase?retryWrites=true&w=majority';
// MERN Account -> Dulthiwanka2015@gmail.com
const DB_URL = 'mongodb+srv://itpproject:projectpass@cluster0.ximc9.mongodb.net/customerdb?retryWrites=true&w=majority';
//dulajthiwanka909@gmail.com
mongoose.connect(DB_URL,{
//useNewUrlParser: true,
//useUnifiedTopology: true,
})
.then(() => {
console.log("Mongo DB Connectected");
})
.catch(err => console.error("DB Connectection error",err));
app.listen(PORT, ()=> {
console.log(`App is Running on ${PORT}`);
});