add a bunch of stuff copied from Foxchat.NET
This commit is contained in:
		
							parent
							
								
									f4c0a40259
								
							
						
					
					
						commit
						6114f384a0
					
				
					 21 changed files with 1216 additions and 35 deletions
				
			
		|  | @ -1,6 +1,8 @@ | |||
| using Foxnouns.Backend; | ||||
| using Foxnouns.Backend.Database; | ||||
| using Serilog; | ||||
| using Foxnouns.Backend.Extensions; | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
| using Newtonsoft.Json.Serialization; | ||||
| 
 | ||||
| var builder = WebApplication.CreateBuilder(args); | ||||
|  | @ -15,21 +17,31 @@ builder.Services | |||
|         options.SerializerSettings.ContractResolver = new DefaultContractResolver | ||||
|         { | ||||
|             NamingStrategy = new SnakeCaseNamingStrategy() | ||||
|         }); | ||||
|         }) | ||||
|     .ConfigureApiBehaviorOptions(options => | ||||
|     { | ||||
|         options.InvalidModelStateResponseFactory = actionContext => new BadRequestObjectResult( | ||||
|             new ApiError.BadRequest("Bad request", actionContext.ModelState).ToJson() | ||||
|         ); | ||||
|     }); | ||||
| 
 | ||||
| builder.Services | ||||
|     .AddDbContext<DatabaseContext>() | ||||
|     .AddSnowflakeGenerator() | ||||
|     .AddCustomServices() | ||||
|     .AddCustomMiddleware() | ||||
|     .AddEndpointsApiExplorer() | ||||
|     .AddSwaggerGen(); | ||||
| 
 | ||||
| var app = builder.Build(); | ||||
| 
 | ||||
| await app.Initialize(args); | ||||
| 
 | ||||
| app.UseSerilogRequestLogging(); | ||||
| app.UseRouting(); | ||||
| app.UseSwagger(); | ||||
| app.UseSwaggerUI(); | ||||
| app.UseCors(); | ||||
| app.UseCustomMiddleware(); | ||||
| app.MapControllers(); | ||||
| 
 | ||||
| app.Urls.Clear(); | ||||
|  | @ -37,4 +49,4 @@ app.Urls.Add(config.Address); | |||
| 
 | ||||
| app.Run(); | ||||
| 
 | ||||
| Log.CloseAndFlush(); | ||||
| Log.CloseAndFlush(); | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue