43 lines
1.8 KiB
C#
43 lines
1.8 KiB
C#
using System.Diagnostics;
|
|
using GerstITS.Web.Api;
|
|
using GerstITS.Web.Api.Hosting;
|
|
using GerstITS.Web.Api.Swagger;
|
|
using Microsoft.AspNetCore.Builder;
|
|
using Serilog;
|
|
|
|
namespace GerstITS.Examples.Api;
|
|
|
|
public class Program
|
|
{
|
|
#region Methods
|
|
|
|
public static void Main(string[] args)
|
|
{
|
|
HostingStartup.Use(args)
|
|
.Host()
|
|
.UseSerilog((context, configuration) => {
|
|
configuration.ReadFrom.Configuration(context.Configuration);
|
|
|
|
if (Common.ApplicationEnvironment.IsEfCoreActionStarted)
|
|
Debug.WriteLine("==========>>>>>>> Do NOT start Application!!!!");
|
|
})
|
|
.Services()
|
|
.Build()
|
|
.IfProduction(app => app.UsePreconfiguredHsts())
|
|
.IfDevelopment(app => app.UseDeveloperExceptionPage()
|
|
.UsePreconfiguredSwagger())
|
|
.UsePreconfiguredCors()
|
|
.UsePreconfiguredForwardedHeaders()
|
|
.UsePreconfiguredHttpsRedirection()
|
|
.UseAuthentication()
|
|
.UseAuthorization()
|
|
.UseRouting()
|
|
.UseEndpoints(endpoints => endpoints.MapControllers())
|
|
.UseRewriteUnknownPathsToIndexSite(ApplicationEnvironment.WebApi.BaseUrl)
|
|
.UseSystemIndependentStaticFiles()
|
|
.UseSerilogRequestLogging()
|
|
.Run();
|
|
}
|
|
|
|
#endregion
|
|
} |