-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.js
More file actions
30 lines (26 loc) · 1.25 KB
/
Copy pathindex.js
File metadata and controls
30 lines (26 loc) · 1.25 KB
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
const express = require('express');
const cookieParser = require('cookie-parser')
const authorizer = require("./backend/auth/authorizer");
const app = express();
const port = process.env.PORT || 3000;
app.use(cookieParser())
app.use('/backend', require('./backend/routes.js'))
app.use("/static", express.static('../frontend/my-app/build/public'));
app.get("/", authorizer.isAuthorizedRedirect, (req, res) => {
return res.sendFile('frontend/my-app/build/index.html', { root: "./"});
});
app.get("/messages", authorizer.isAuthorizedRedirect, (req, res) => {
return res.sendFile('frontend/my-app/build/index.html', { root: "./"});
});
app.get("/update", authorizer.isAuthorizedRedirect, (req, res) => {
return res.sendFile('frontend/my-app/build/index.html', { root: "./"});
});
app.get("/inventory", authorizer.isAuthorizedRedirect, (req, res) => {
return res.sendFile('frontend/my-app/build/index.html', { root: "./"});
});
app.get("/login", (req, res) => {
res.cookie("auth", JSON.stringify({loggedIn: false, username: null, shelterId: null}));
return res.sendFile('frontend/my-app/build/index.html', { root: "./"});
});
app.use("/", express.static('frontend/my-app/build/'));
app.listen(port, () => console.log(`Fullhouse listening on port ${port}!`))