Last active
November 6, 2025 04:36
-
-
Save rkttu/94549f5607e069eb8f5493bea7fae6f8 to your computer and use it in GitHub Desktop.
Multi-host File-based App
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env dotnet | |
| #:sdk Microsoft.NET.Sdk.Web | |
| var builder = WebApplication.CreateBuilder(args); | |
| using var app = builder.Build(); | |
| app.UseHttpsRedirection(); | |
| app.MapGet("/", () => "Hello from A").RequireHost("a.dev.localhost"); | |
| app.MapGet("/", () => "Hello from B").RequireHost("b.dev.localhost"); | |
| app.MapGet("/", () => "Hello from Prod"); | |
| app.Run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment