-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
40 lines (35 loc) · 1.23 KB
/
index.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
const express = require('express');
const cors = require('cors');
const router = require('./src/routes/route.js');
// const authrouter = require('./src/routes/Routes.js');
const mongoose = require('mongoose');
mongoose.set('strictQuery', true);
const app = express();
app.use(cors());
app.use(express.json());
const bodyParser = require('body-parser'); //
// app.use(bodyParser.urlencoded({limit: '5000mb', extended: true, parameterLimit: 100000000000})); //
app.use(
bodyParser.urlencoded({
extended: true,
})
);
// mongodb+srv://iiitvicd:[email protected]/TechFest?retryWrites=true&w=majority
mongoose.connect('mongodb+srv://iiitvicd:[email protected]/TechFest?retryWrites=true&w=majority' , {
useNewUrlParser: true,
useUnifiedTopology: true
}, (err) => {
if (!err) {
console.log('MongoDB Connection Succeeded.');
} else {
console.log('Error in DB connection : ' + err);
}
});
app.use('/', router);
// app.use('/auth', authrouter);
app.all('/**', (req, res) => {
res.status(404).send({ status: false, message: 'Page Not Found!' });
});
app.listen(process.env.PORT || 3000, function () {
console.log('Express app running on port ' + (process.env.PORT || 3000));
});