mirror of
https://github.com/usatiuk/photos.git
synced 2025-10-28 07:27:47 +01:00
add proxy for api in dev
so it works in codespaces hopefully didn't break anything
This commit is contained in:
@@ -50,6 +50,10 @@ docker-compose example in `dockercomposeexample` folder
|
||||
|
||||
* `HTTPS` (`"yes"`/`"no"`) - whether the server enforce HTTPS or not
|
||||
|
||||
* `API_ROOT`
|
||||
|
||||
* `WEB_ROOT`
|
||||
|
||||
### Additional config options if you're not using docker
|
||||
|
||||
* `DATA_DIR` - data directory for photos and uploaded files
|
||||
|
||||
8
frontend/.proxyrc
Normal file
8
frontend/.proxyrc
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"/api": {
|
||||
"target": "http://localhost:3000/",
|
||||
"pathRewrite": {
|
||||
"^/api": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
export const apiRoot =
|
||||
process.env.API_ROOT ||
|
||||
process.env.NODE_ENV === "production" ||
|
||||
!process.env.NODE_ENV
|
||||
(!process.env.NODE_ENV || process.env.NODE_ENV === "production"
|
||||
? window.location.origin
|
||||
: "http://localhost:3000";
|
||||
: process.env.NODE_ENV === "development" &&
|
||||
window.location.origin + "/api");
|
||||
export const webRoot =
|
||||
process.env.WEB_ROOT ||
|
||||
process.env.NODE_ENV === "production" ||
|
||||
!process.env.NODE_ENV
|
||||
(!process.env.NODE_ENV || process.env.NODE_ENV === "production"
|
||||
? window.location.origin
|
||||
: "http://localhost:1234";
|
||||
: "http://localhost:1234");
|
||||
|
||||
Reference in New Issue
Block a user