# Gateway routing for the three snip services.
# Path ownership (matches the app's reserved paths):
#   /api/*                      -> api service
#   /, /login, /dashboard       -> frontend (SPA shell)
#   /assets/*, /favicon.svg     -> frontend (static)
#   everything else (/{code})   -> redirect service

:80 {
	encode gzip

	handle /api/* {
		reverse_proxy api:8080
	}

	# SPA app routes + static assets are owned by the frontend service.
	handle /assets/* {
		reverse_proxy frontend:8081
	}
	@app path / /login /dashboard /favicon.svg /favicon_dark.svg /robots.txt
	handle @app {
		reverse_proxy frontend:8081
	}

	# Anything else is a short code → redirect service.
	handle {
		reverse_proxy redirect:8082
	}
}
