-
-
Save fzankl/d2e81b97d88aaaf3bc8599ff622025af to your computer and use it in GitHub Desktop.
Creating a Kestrel server using a Unix socket
This file contains 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
const string UnixSocketPath = "/tmp/foo.sock"; | |
if (File.Exists(UnixSocketPath)) | |
{ | |
File.Delete(UnixSocketPath); | |
} | |
var builder = WebApplication.CreateBuilder(args); | |
builder.WebHost.ConfigureKestrel(options => | |
{ | |
options.ListenUnixSocket(UnixSocketPath); | |
}); | |
var app = builder.Build(); | |
app.MapGet("/", () => "Hello from Foo API served via Unix Socket."); | |
app.Run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment