claude-test/backend/ClaudeTest.API/Program.cs
Martin Švrčina 982b6d5fa6 Add NSwag for automatic TypeScript API client generation
- Replace Swashbuckle with NSwag.AspNetCore + NSwag.MSBuild
- Configure OpenAPI document in Program.cs via AddOpenApiDocument
- Add nswag.json: aspNetCoreToOpenApi → Axios TypeScript client
- Post-build target uses NSwagExe_Net80 to run on correct runtime
- Client generated to frontend/src/api/apiClient.ts (gitignored)
- Add axios to frontend dependencies

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 00:36:30 +01:00

23 lines
404 B
C#

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
builder.Services.AddOpenApiDocument(config =>
{
config.Title = "ClaudeTest API";
config.Version = "v1";
});
var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.UseOpenApi();
app.UseSwaggerUi();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();