Skip to content

Instantly share code, notes, and snippets.

@wullemsb
Created March 23, 2024 13:20
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
//Your API should be listening on the /api route
app.MapGet("/api/hello") =>
{
return $"hello world";
})
.WithName("GetHello")
.WithOpenApi();
app.Run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment