Skip to content

Commit

Permalink
fix: Fix routing for development mode
Browse files Browse the repository at this point in the history
  • Loading branch information
huyenngn committed Apr 10, 2024
1 parent bf9b803 commit 3e5ad9a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 6 additions & 3 deletions frontend/src/APIConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };

0 comments on commit 3e5ad9a

Please sign in to comment.