Created
August 13, 2023 11:46
-
-
Save otienoelvis/7b0ab36a07cd61cc373afcce017c6345 to your computer and use it in GitHub Desktop.
Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Serilog; | |
var builder = WebApplication.CreateBuilder(args); | |
builder.Host.UseSerilog((ctx, cfg) => cfg | |
.WriteTo.Console() | |
.ReadFrom.Configuration(ctx.Configuration)); | |
builder.Services.AddControllers(); | |
builder.Services.AddEndpointsApiExplorer(); | |
builder.Services.AddSwaggerGen(); | |
var app = builder.Build(); | |
if (app.Environment.IsDevelopment()) | |
{ | |
app.UseSwagger(); | |
app.UseSwaggerUI(); | |
} | |
app.UseSerilogRequestLogging(); | |
app.UseHttpsRedirection(); | |
app.UseAuthorization(); | |
app.MapControllers(); | |
app.Run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment