var builder = WebApplication.CreateBuilder(args); // Configure port from environment variable (set by GitCaddy AddonManager) var port = Environment.GetEnvironmentVariable("ADDON_HOST_PORT") ?? "47933"; builder.WebHost.UseUrls($"http://127.0.0.1:{port}"); var app = builder.Build(); // Root endpoint app.MapGet("/", () => new { status = "ok", service = "MyFirstAddon.Host", version = "1.0.0" }); // Health check endpoint (required by GitCaddy) app.MapGet("/health", () => new { status = "healthy", timestamp = DateTime.UtcNow }); // Hello World endpoint - demonstrates a simple addon host function app.MapGet("/hello", () => new { message = "Hello World from MyFirstAddon.Host!", timestamp = DateTime.UtcNow }); // Hello endpoint with name parameter app.MapGet("/hello/{name}", (string name) => new { message = $"Hello, {name}!", timestamp = DateTime.UtcNow }); Console.WriteLine($"MyFirstAddon.Host starting on http://127.0.0.1:{port}"); app.Run();