1
0
mirror of https://github.com/alexandrev/xslt-lab.git synced 2026-09-16 18:23:16 +00:00

feat: make backend URL configurable

This commit is contained in:
2025-07-01 18:06:44 +02:00
parent 1f76646d20
commit 45f734a444
4 changed files with 24 additions and 3 deletions
+12 -1
View File
@@ -13,13 +13,21 @@ npm run dev
This starts the playground at `http://localhost:3000`.
The app will call the Go backend at `/transform` to perform XSLT transformations.
Set the backend URL by creating a `.env` file inside `frontend/`:
```bash
VITE_BACKEND_URL=http://localhost:8000
```
If omitted the app assumes the backend runs on the same host and port.
### Docker
To build a container with the compiled frontend run:
```bash
docker build -t xslt-playground-frontend frontend
docker build -t xslt-playground-frontend \
--build-arg VITE_BACKEND_URL=http://localhost:8000 frontend
```
The resulting image serves the static files with nginx on port 80.
@@ -80,4 +88,7 @@ make backend-image frontend-image
docker compose up
```
The compose file builds the frontend with `VITE_BACKEND_URL=http://backend:8000`
so it talks to the backend container.
This starts the backend on port `8000`, the frontend on `3000` and a PostgreSQL instance on `5432`.