-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
40 lines (32 loc) · 877 Bytes
/
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 mongoose = require('mongoose');
const authRoute = require('./routes/auth')
const claimRoute = require('./routes/claim')
require('dotenv').config()
const app = express();
const port = process.env.PORT;
app.use(cors());
app.use(express.json());
app.use(express.urlencoded({ extended: false }))
mongoose.set('strictQuery', true)
mongoose
.connect(process.env.DBPATH, {
useUnifiedTopology: true,
useNewUrlParser: true,
})
.then(() => {
console.log('Connected to MongoDB')
})
.catch((error) => {
console.log('Connection Error', error)
})
app.get('/', (req, res) => {
res.json({
message: "Welcome to the Edudigm Application",
status: 200
});
});
app.use('/auth', authRoute);
app.use('/claim', claimRoute);
app.listen(port);