Files
predavanja/Events-WebApi

Solution Overview

Swagger UI is exposed at:

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
  • 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:

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 is:

  • Auth:Authority=https://fer-web2.eu.auth0.com/
  • Auth:Audience=https://erasmus-sta-2026/events-api

Set the PostgreSQL connection string:

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:

./Certificates

Running Required Infrastructure

Start PostgreSQL using the repository Docker definitions:

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:

docker run -d --name rabbitmq-erasmus-sta -p 5672:5672 -p 15672:15672 rabbitmq:4-management

The RabbitMQ management UI is usually available at:

http://localhost:15672

Running The Web API

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 for full details.

Typical local flow:

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