122 lines
3.6 KiB
Markdown
122 lines
3.6 KiB
Markdown
## Solution Overview
|
|
|
|
|
|
|
|
Swagger UI is exposed at:
|
|
|
|
```text
|
|
https://localhost:7290/docs
|
|
```
|
|
|
|
The exact port may vary depending on your local launch profile.
|
|
|
|
## Prerequisites
|
|
|
|
- .NET SDK 10.0
|
|
- Docker Desktop
|
|
- PostgreSQL, usually via [docker-definitions](docker-definitions/README.md)
|
|
- RabbitMQ if you want to run the full API with its real MassTransit transport
|
|
- Node.js 20+ for the client app
|
|
- An Auth0 tenant if you want to run real bearer-token and browser-login flows outside the test suite
|
|
|
|
## Configuration
|
|
|
|
`Events.WebAPI` reads settings from:
|
|
|
|
- [Events.WebAPI/appsettings.json](Topic2/Events.WebAPI/appsettings.json)
|
|
- [Events.WebAPI/appsettings.Development.json](Topic2/Events.WebAPI/appsettings.Development.json)
|
|
- the shared .NET user secrets store with id `Erasmus-STA-2026`
|
|
|
|
Important configuration sections:
|
|
|
|
- `ConnectionStrings:EventDB`
|
|
- `RabbitMq:Host`
|
|
- `RabbitMq:Username`
|
|
- `RabbitMq:Password`
|
|
- `Auth:Authority`
|
|
- `Auth:Audience`
|
|
- `Paths:Certificates`
|
|
|
|
The current Auth configuration in [Events.WebAPI/appsettings.json](Topic2/Events.WebAPI/appsettings.json) is:
|
|
|
|
- `Auth:Authority=https://fer-web2.eu.auth0.com/`
|
|
- `Auth:Audience=https://erasmus-sta-2026/events-api`
|
|
|
|
Set the PostgreSQL connection string:
|
|
|
|
```powershell
|
|
dotnet user-secrets set "ConnectionStrings:EventDB" "Host=localhost;Port=5432;Database=events;Username=sport;Password=your-password;Persist Security Info=True;" --project Topic2\Events.WebAPI\Events.WebAPI.csproj
|
|
```
|
|
|
|
You can also override RabbitMQ and Auth settings with user secrets if you do not want to keep local values in `appsettings.json`.
|
|
|
|
For the SPA client, copy `Topic2/Events.ClientApp/.env.example` to `.env.local`. The example file already contains the current Auth0 values used by this repository:
|
|
|
|
- `VITE_AUTH0_DOMAIN=fer-web2.eu.auth0.com`
|
|
- `VITE_AUTH0_CLIENT_ID=whed5Hdb8l1b1fGyyAz7Qrdsb2oKcSh3`
|
|
- `VITE_AUTH0_AUDIENCE=https://erasmus-sta-2026/events-api`
|
|
|
|
`Paths:Certificates` points to the directory where generated certificates and Excel files are stored. By default it is:
|
|
|
|
```text
|
|
./Certificates
|
|
```
|
|
|
|
## Running Required Infrastructure
|
|
|
|
Start PostgreSQL using the repository Docker definitions:
|
|
|
|
```powershell
|
|
docker compose -f docker-definitions\postgres-eventsdb\docker-compose.yml up -d
|
|
```
|
|
|
|
Start RabbitMQ if you want the API to use its real MassTransit transport:
|
|
|
|
```powershell
|
|
docker run -d --name rabbitmq-erasmus-sta -p 5672:5672 -p 15672:15672 rabbitmq:4-management
|
|
```
|
|
|
|
The RabbitMQ management UI is usually available at:
|
|
|
|
```text
|
|
http://localhost:15672
|
|
```
|
|
|
|
## Running The Web API
|
|
|
|
```powershell
|
|
dotnet restore Topic2\Topic2.sln
|
|
dotnet build Topic2\Topic2.sln
|
|
dotnet run --project Topic2\Events.WebAPI\Events.WebAPI.csproj
|
|
```
|
|
|
|
Once the API is running:
|
|
|
|
- open Swagger at `/docs`
|
|
- test anonymous lookup endpoints
|
|
- test secured endpoints with a valid bearer token if your Auth0 configuration is set
|
|
|
|
## Running The Client App
|
|
|
|
See [Events.ClientApp/README.md](Topic2/Events.ClientApp/README.md) for full details.
|
|
|
|
Typical local flow:
|
|
|
|
```powershell
|
|
cd Topic2\Events.ClientApp
|
|
npm install
|
|
npm run dev
|
|
```
|
|
|
|
The client expects:
|
|
|
|
- `VITE_API_BASE_URL` pointing to the running API
|
|
- Auth0 SPA settings if login is enabled
|
|
|
|
## Troubleshooting
|
|
|
|
- If the API fails at startup, verify `ConnectionStrings:EventDB`, RabbitMQ connectivity, and `Paths:Certificates`
|
|
- If Swagger opens but secured requests fail, verify `Auth:Authority`, `Auth:Audience`, and the token scopes
|
|
- If the client loads but cannot authenticate, verify the values in `.env.local`
|
|
- If generated certificates or Excel exports are missing, verify that the output directory exists and is writable
|