mirror of
https://gitea.tendokyu.moe/ppc/amnet.git
synced 2026-09-30 02:38:09 +03:00
rename server project
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user