diff --git a/README.md b/README.md index 9b47c6f..5485cfa 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ While the thing is running you can edit the templates in the `templates` folder # Development (local) -To run the app in dev mode you'll need to first run `npm run build` inside `frontend` and then `sh entrypoint.sh` - this is needed by the backend to have some statics to serve. Then run `npm run dev` in a terminal and `python -m capella_model_explorer.backend path_to_model path_to_templates` in another terminal. The backend and statically built frontend will be served at `http://localhost:8000`. The live frontend will be served by vite at `http://localhost:5173`(or similar, it will be printed in the terminal where you ran `npm run dev`). +To run the app in dev mode you'll need to first run `npm run build` - this is needed by the backend to have some statics to serve. Then run `npm run dev` in a terminal and `python -m capella_model_explorer.backend path_to_model path_to_templates` in another terminal. The backend and statically built frontend will be served at `http://localhost:8000`. The live frontend will be served by vite at `http://localhost:5173`(or similar, it will be printed in the terminal where you ran `npm run dev`). # Documentation diff --git a/frontend/src/APIConfig.js b/frontend/src/APIConfig.js index db78d82..bfb2c19 100644 --- a/frontend/src/APIConfig.js +++ b/frontend/src/APIConfig.js @@ -3,7 +3,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -const API_BASE_URL = "http://localhost:8000__ROUTE_PREFIX__/api"; -const ROUTE_PREFIX = "__ROUTE_PREFIX__"; - +var API_BASE_URL = "http://localhost:8000__ROUTE_PREFIX__/api"; +var ROUTE_PREFIX = "__ROUTE_PREFIX__"; +if (!process.env.NODE_ENV || process.env.NODE_ENV === "development") { + API_BASE_URL = "http://localhost:8000/api"; + ROUTE_PREFIX = ""; +} export { API_BASE_URL, ROUTE_PREFIX };