-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
42 lines (34 loc) · 1.29 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
41
42
require("dotenv").config();
const express = require("express");
const app = express();
const PORT = process.env.PORT || 8081;
const cookieParser = require("cookie-parser");
const passport = require("passport");
const salutesRoutes = require("./server/routes/salutes.routes");
const passportConf = require("./server/config/passport.conf");
const albumRoutes = require("./server/routes/album.routes");
const purchasesRoutes =require("./server/routes/purchases.routes");
const usersRoutes = require("./server/routes/users.routes");
const venturesRoutes = require("./server/routes/ventures.routes");
const ventfavRoutes = require("./server/routes/ventfav.routes");
app.use(express.json());
passportConf(passport);
app.use(cookieParser());
app.use(passport.initialize());
app.use(express.static(__dirname + "/build"));
app.use("/api/album", albumRoutes);
app.use("/api/purchases", purchasesRoutes);
app.use("/api/salutes", salutesRoutes);
app.use("/api/users", usersRoutes);
app.use("/api/ventfav", ventfavRoutes);
app.use("/api/ventures", venturesRoutes);
app.get("/", (req, res) =>{
console.log(req.url);
res.send("<h4><hello></h4>");
});
app.get("*", (req, res) => {
return res.sendFile("/build/index.html", { root: __dirname + "/" });
});
app.listen(PORT, function(){
console.log("No whammies on port 65001");
})