-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
34 lines (27 loc) · 1.11 KB
/
server.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
require("dotenv").config();
const express = require("express");
const bodyParser = require("body-parser");
const path = require("path");
const passport = require("passport");
const deleteOldMovies = require('./deleteOldMovies')
var CronJob = require("cron").CronJob;
const app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
require("./server/config/passport");
app.use(passport.initialize());
app.use(express.static(path.join(__dirname, "build")));
app.use(passport.initialize());
app.use("/api/users", require("./server/routes/user_router"));
app.use("/api/images", require("./server/routes/images/images_router"));
app.use("/api/home", require("./server/routes/home/home_router"));
app.use("/api/player", require("./server/routes/player/player_router"));
app.use("/api/movies", require("./server/routes/movies/movies_router"));
deleteOldMovies()
new CronJob("0 0 * * *", deleteOldMovies).start();
app.get("/", function (req, res) {
res.sendFile(path.join(__dirname, "build", "index.html"));
});
app.listen(process.env.PORT || 8080, () => {
console.log(`Server is listening!`);
});