Skip to content

Commit

Permalink
fix: attempt to fix not found page in deployed app in azure app service
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvink96 committed Nov 17, 2024
1 parent 2779b4c commit a6d68eb
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions AdminHubApi/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
builder.Services.AddSwaggerGen(option =>
{
option.SwaggerDoc("v1", new OpenApiInfo { Title = "Admin Hub Api", Version = "v1" });
option.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
In = ParameterLocation.Header,
Expand All @@ -30,18 +31,19 @@
BearerFormat = "JWT",
Scheme = "Bearer"
});
option.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type=ReferenceType.SecurityScheme,
Id="Bearer"
Type = ReferenceType.SecurityScheme,
Id = "Bearer"
}
},
new string[]{}
new string[] { }
}
});
});
Expand Down Expand Up @@ -96,11 +98,27 @@

app.UseSwagger();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
app.UseSwaggerUI(options =>
{
app.UseSwaggerUI();
}
options.SwaggerEndpoint("/swagger/v1/swagger.json", "Web API V1");
if (app.Environment.IsDevelopment())
{
options.RoutePrefix = "swagger";
}
else
{
options.RoutePrefix = string.Empty;
}
});

app.UseSwagger();

// // Configure the HTTP request pipeline.
// if (app.Environment.IsDevelopment())
// {
// app.UseSwaggerUI();
// }

app.UseHttpsRedirection();

Expand Down

0 comments on commit a6d68eb

Please sign in to comment.