« Scalar » : différence entre les versions
Apparence
Aucun résumé des modifications |
Balise : Révocation manuelle |
||
(9 versions intermédiaires par le même utilisateur non affichées) | |||
Ligne 1 : | Ligne 1 : | ||
[[Category:.NET Core]] | [[Category:.NET Core]] | ||
= Links = | |||
* [https://github.com/scalar/scalar Scalar] | |||
* [https://learn.microsoft.com/en-us/aspnet/core/fundamentals/openapi/using-openapi-documents?view=aspnetcore-9.0#use-scalar-for-interactive-api-documentation Use Scalar for interactive API documentation] | |||
= [https://github.com/scalar/scalar/blob/main/packages/scalar.aspnetcore/README.md ASP.NET Core 9 integration] = | = [https://github.com/scalar/scalar/blob/main/packages/scalar.aspnetcore/README.md ASP.NET Core 9 integration] = | ||
<kode lang='ps'> | |||
dotnet add package Scalar.AspNetCore | |||
</kode> | |||
<filebox fn='Program.cs'> | |||
builder.Services.AddOpenApi(); | |||
if (app.Environment.IsDevelopment()) | |||
{ | |||
app.MapOpenApi(); | |||
// add the following lines | |||
app.MapScalarApiReference(options => | |||
{ | |||
options | |||
.WithDefaultOpenAllTags(true) | |||
.WithTheme(ScalarTheme.Solarized); | |||
}); | |||
} | |||
</filebox> | |||
URL: {{boxx|http://localhost:5000/scalar}} | |||
<filebox fn='Properties/launchSettings.json'> | |||
{ | |||
"profiles": { | |||
"http": { | |||
"launchBrowser": true, | |||
"launchUrl": "http://localhost:5000/scalar", | |||
"applicationUrl": "http://localhost:5000" | |||
} | |||
} | |||
} | |||
</filebox> |
Dernière version du 18 janvier 2025 à 15:42
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
.WithDefaultOpenAllTags(true)
.WithTheme(ScalarTheme.Solarized);
});
}
|
URL: http://localhost:5000/scalar
Properties/launchSettings.json |
{
"profiles": {
"http": {
"launchBrowser": true,
"launchUrl": "http://localhost:5000/scalar",
"applicationUrl": "http://localhost:5000"
}
}
}
|