Modified to serve frontend and react through photos

Signed-off-by: James Ketrenos <james_gitlab@ketrenos.com>
This commit is contained in:
James Ketrenos 2020-02-08 14:47:21 -08:00
parent 09e07320a6
commit a1787a172a
3 changed files with 15 additions and 5 deletions

View File

@ -13,6 +13,7 @@ const router = express.Router();
router.put("/faces/add/:id", (req, res) => {
if (!req.user.maintainer) {
console.warn(`${req.user.name} attempted to modify photos.`);
return res.status(401).send("Unauthorized to modify photos.");
}
@ -45,6 +46,7 @@ router.put("/faces/add/:id", (req, res) => {
router.post("/", (req, res) => {
if (!req.user.maintainer) {
console.warn(`${req.user.name} attempted to modify photos.`);
return res.status(401).send("Unauthorized to modify photos.");
}
const identity = {

View File

@ -8,7 +8,7 @@ if (process.env.NODE_ENV !== 'production') {
}
render(
<BrowserRouter basename="/">
<BrowserRouter basename="/photos">
<App/>
</BrowserRouter>,
document.getElementById("root")

View File

@ -8,14 +8,22 @@ module.exports = merge(common, {
devServer: {
contentBase: path.join(__dirname, "/"),
port: 8765,
publicPath: "http://localhost:8765/dist/",
publicPath: "http://localhost:8765/photos/dist/",
hotOnly: true,
disableHostCheck: true,
historyApiFallback: true,
proxy: {
"/api": "http://localhost:8123/photos",
"/photos/*": {
target: "http://localhost:8123"
// "/photos/api/*": "http://localhost:8123/",
"/photos/": {
target: "http://localhost:8123",
bypass: function(req, res, proxyOptions) {
console.log(req.url);
if (req.url == '/photos/identities') {
return 'index.html';
} else {
return null;
}
}
}
},
},