Aller au contenu

« Scalar » : différence entre les versions

De Banane Atomic
Ligne 19 : Ligne 19 :
     {
     {
         options
         options
             .WithDefaultOpenAllTags(true)
             .WithTitle("MyApp API Reference")
             .WithTheme(ScalarTheme.Solarized);
             .WithTheme(ScalarTheme.Solarized)
            .WithClientButton(false);
            //.WithDefaultOpenAllTags(true)
     });
     });
}
}

Version du 3 avril 2025 à 09:36

Links

ASP.NET Core 9 integration

dotnet add package Scalar.AspNetCore
Program.cs
builder.Services.AddOpenApi();

if (app.Environment.IsDevelopment())
{
    app.MapOpenApi();
    // add the following lines
    app.MapScalarApiReference(options =>
    {
        options
            .WithTitle("MyApp API Reference")
            .WithTheme(ScalarTheme.Solarized)
            .WithClientButton(false);
            //.WithDefaultOpenAllTags(true)
    });
}

URL: http://localhost:5000/scalar

Properties/launchSettings.json
{
  "profiles": {
    "http": {
      "launchBrowser": true,
      "launchUrl": "http://localhost:5000/scalar",
      "applicationUrl": "http://localhost:5000"
    }
  }
}