-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
31 lines (24 loc) · 872 Bytes
/
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
var express = require("express");
var path = require("path");
var logger = require("morgan");
require("dotenv").config();
require("./backend/config/database");
var bodyParser = require("body-parser");
require("body-parser-zlib")(bodyParser);
const auth = require("./backend/config/auth");
const app = express();
require("./backend/config/database");
const port = process.env.PORT || 3001;
app.use(logger("dev"));
app.use(express.json());
app.use(auth);
app.use(express.static(path.join(__dirname, "./build")));
app.use("/files", express.static("files"));
app.use("/api/users", require("./backend/routes/api/users"));
app.use("/api", require("./backend/routes/api/files"));
app.get("/*", function (req, res) {
res.sendFile(path.join(__dirname, "./build", "index.html"));
});
app.listen(port, function () {
console.log(`Express app running on port ${port}`);
});