-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
28 lines (24 loc) · 811 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
const dotenv = require("dotenv").config();
const express = require("express");
const cors = require("cors"); // Add the cors middleware
var app = express();
const isAuth = require("./middleware/auth.middleware");
var bible = require("./routes/bible.route");
var reflection = require("./routes/reflection.route");
var song = require("./routes/song.route");
app.use(
cors({
origin: ["http://localhost:8100", "*"],
methods: ["GET", "POST", "PUT", "DELETE"],
credentials: true,
})
);
app.get("/", (req, res) => {
res.send(new String("soli deo gloria"));
});
app.use("/bible", isAuth, bible);
app.use("/reflection", isAuth, reflection);
app.use("/song", isAuth, song);
app.listen(process.env.PORT, "0.0.0.0", () => {
console.log(`server started at http://localhost:${process.env.PORT}`);
});