feat: add scalar ui

This commit is contained in:
Fernando Araoz 2025-01-11 16:29:43 -05:00
parent e8ec8f8e5c
commit 0a4f4b9dfc
6 changed files with 13 additions and 34 deletions

View File

@ -1,9 +1,9 @@
FROM mcr.microsoft.com/dotnet/sdk:9.0
FROM mcr.microsoft.com/dotnet/sdk:8.0
WORKDIR /app
# Set ASP.NET to actually listen on all interfaces, not just localhost
ENV ASPNETCORE_URLS=http://+:5266
ENV ASPNETCORE_URLS=http://+:5233
# Allow non-HTTPS because it's just development, who cares
ENV ASPNETCORE_ENVIRONMENT=Development

View File

@ -1,10 +1,10 @@
FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
WORKDIR /app
COPY . .
RUN dotnet restore
RUN dotnet publish -c Release -o out
FROM mcr.microsoft.com/dotnet/aspnet:9.0-alpine
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine
WORKDIR /app
COPY --from=build /app/out .

View File

@ -1,3 +1,5 @@
using Scalar.AspNetCore;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
@ -12,8 +14,11 @@ var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
app.UseSwagger(options =>
{
options.RouteTemplate = "openapi/{documentName}.json";
});
app.MapScalarApiReference();
}
app.UseHttpsRedirection();

View File

@ -1,41 +1,14 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:22703",
"sslPort": 44392
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5233",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7038;http://localhost:5233",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@ -7,6 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Scalar.AspNetCore" Version="1.2.*" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
</ItemGroup>

View File

@ -5,7 +5,7 @@ services:
context: .
dockerfile: Dockerfile
ports:
- "5266:5266"
- "5233:5233"
volumes:
- ./:/app
networks: