Skip to content

Instantly share code, notes, and snippets.

@iozcelik
Created April 6, 2025 07:54
Show Gist options
  • Save iozcelik/494ac0263f4923552f68e45c8545d8a2 to your computer and use it in GitHub Desktop.
Save iozcelik/494ac0263f4923552f68e45c8545d8a2 to your computer and use it in GitHub Desktop.
.NET 9 OpenApi using with FastEndpoints and Scalar
using FastEndpoints;
using Scalar.AspNetCore;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddOpenApi();
builder.Services.AddFastEndpoints()
.AddOpenApiDocument();
var app = builder.Build();
app.UseFastEndpoints()
.UseOpenApi();
if (app.Environment.IsDevelopment())
{
app.MapOpenApi();
app.MapScalarApiReference();
}
app.UseHttpsRedirection();
app.Run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment