-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
34 lines (29 loc) · 929 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
const express = require("express")
const cors = require("cors")
const app = express()
const paymentRoutes = require("./routes/payments")
const databaseRoutes = require("./routes/dbInteractions")
const mongoose = require("mongoose")
app.use(express.json())
app.use(cors())
app.use("/payment", paymentRoutes)
app.use("/db", databaseRoutes)
// TEST ROUTES
// app.get("/", (req, res) => {
// checkStudentRegistrationStatus("abc")
// })
// app.post("/", (req, res) => {
// console.log(req.body)
// addDataToDatabase(1, req.body)
// })
app.listen(process.env.PORT || 5000, () => {
console.log(`Process runnning in port ${process.env.PORT || 5000}`)
const uri = process.env.MONGO_URI
const options = {
useNewUrlParser: true,
useUnifiedTopology: true
}
mongoose.connect(uri, options).then(data => {
console.log("Connected to DB")
}).catch(err => console.log(err))
})