document backend switching

This commit is contained in:
2026-04-21 18:41:24 -06:00
parent e0505cbaaa
commit 68055ba720

View File

@@ -79,7 +79,7 @@ npm run dev
The web app starts at `http://localhost:3000`. The web app starts at `http://localhost:3000`.
### 5. Run the desktop client (optional) ### 5. Run the desktop client
```sh ```sh
cd desktop cd desktop
@@ -87,10 +87,61 @@ cp connectionpetstore.properties.example connectionpetstore.properties
mvn javafx:run mvn javafx:run
``` ```
### 6. Run the Android app (optional) ### 6. Run the Android app
Open `android/` in Android Studio and run on an emulator or device. Open `android/` in Android Studio and run on an emulator or device.
## Switching Between Azure and Local Backend
Each client reads the backend URL from a config file. To point a client at the
hosted Azure backend versus a local one, flip the commented lines.
### Web
Edit `web/.env.local`:
```
# Local
BACKEND_URL=http://localhost:8080
#BACKEND_URL=https://petshop-backend.nicepond-c7280126.westus2.azurecontainerapps.io
# Azure
#BACKEND_URL=http://localhost:8080
BACKEND_URL=https://petshop-backend.nicepond-c7280126.westus2.azurecontainerapps.io
```
Restart the dev server after changing.
### Desktop
Edit `desktop/src/main/resources/connectionpetstore.properties`:
```
# Local
api.baseUrl=http://localhost:8080
#api.baseUrl=https://petshop-backend.nicepond-c7280126.westus2.azurecontainerapps.io
# Azure
#api.baseUrl=http://localhost:8080
api.baseUrl=https://petshop-backend.nicepond-c7280126.westus2.azurecontainerapps.io
```
### Android
Edit `android/local.properties`:
```properties
# Local (emulator — 10.0.2.2 maps to host's localhost)
petstore.backend.emulatorUrl=http\://10.0.2.2\:8080/
petstore.backend.deviceUrl=http\://192.168.x.x\:8080/
# Azure
petstore.backend.emulatorUrl=https\://petshop-backend.nicepond-c7280126.westus2.azurecontainerapps.io/
petstore.backend.deviceUrl=https\://petshop-backend.nicepond-c7280126.westus2.azurecontainerapps.io/
```
Sync Gradle and re-run the app.
## API ## API
A Postman collection is available at `backend/postman/`. Key endpoint groups: A Postman collection is available at `backend/postman/`. Key endpoint groups: