rename server project

This commit is contained in:
ppc
2024-08-31 18:46:50 +01:00
parent 98faadad47
commit 1fa0f70113
7 changed files with 4 additions and 6 deletions
+44
View File
@@ -0,0 +1,44 @@
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace AMNet.Server;
internal static class WebServer
{
public static WebApplicationBuilder BuildServer()
{
var builder = WebApplication.CreateSlimBuilder([]);
builder.Logging.ClearProviders();
builder.Logging.AddSimpleConsole(o =>
{
o.SingleLine = true;
o.IncludeScopes = false;
});
builder.Logging.SetMinimumLevel(LogLevel.Information);
builder.Logging.AddFilter("Microsoft.AspNetCore.Http.Result", LogLevel.None);
builder.Logging.AddFilter("Microsoft.AspNetCore.Routing.EndpointMiddleware", LogLevel.Error);
builder.Services.AddCors(cors =>
{
cors.AddDefaultPolicy(policy =>
{
policy.AllowAnyMethod();
policy.AllowAnyOrigin();
policy.AllowAnyHeader();
policy.SetPreflightMaxAge(TimeSpan.FromHours(6));
});
});
builder.Services.ConfigureHttpJsonOptions(options =>
{
options.SerializerOptions.TypeInfoResolverChain.Insert(0, SerializerContext.Default);
});
return builder;
}
}