Files
minattest/frontend/minattest-app-host/README.md
T
Stein Helge Riise ede31fbb7e Initial import
2025-11-17 08:32:46 +01:00

27 lines
1.2 KiB
Markdown

minattest-app-host (BFF)
Overview
- .NET 9 minimal app acting as a reverse proxy for both the React frontend and the API during development.
- Uses YARP to forward:
- `/api/*` to the API (`API_URL`, default `https://localhost:7172`).
- everything else to the frontend dev server (`FRONTEND_URL`, default `http://localhost:5173`).
Configure
- Env vars:
- `FRONTEND_URL` (default: `http://localhost:5173`)
- `API_URL` (default: `https://localhost:7172`)
- `launchSettings.json` sets both for dev profiles.
Run
- Start your API (e.g., at `https://localhost:7172`).
- Start your React dev server (e.g., `npm run dev` on port 5173).
- From repo root: `dotnet run --project frontend/minattest-app-host`
- Open the BFF URL shown in the console (e.g., `https://localhost:10001`).
- Requests to `/api/...` go to your API.
- All other paths (including `/`) go to the React dev server.
Notes
- WebSockets are enabled to support HMR from Vite/CRA dev servers.
- If your API uses the ASP.NET Core dev certificate, ensure it's trusted: `dotnet dev-certs https --trust`.
- Later, add auth and API composition here while keeping the frontend origin hidden from browsers.