pechka-fullstack-setup/Keroosha.Pechka.Web/Program.cs

42 lines
1.2 KiB
C#

// See https://aka.ms/new-console-template for more information
using Keroosha.Pechka.Web.Database;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Pechka.AspNet;
void ConfigureOptions(IConfiguration configuration, IServiceCollection services)
{
services.AddSingleton(new PechkaConfiguration()
{
// TypescriptGenerationOptions = (b) => b.DtoClassNamingPolicy = t => t == typeof(Result<>) ? "ResultT" : t.Name,
WebAppRoot = "Frontend",
WebAppApiPath = "src/api.ts",
WebAppBuildPath = "build"
});
}
void ConfigureManagers(IServiceCollection services)
{
services.AddDbContextManager((z, x) => new AppDbContextManager(z, x));
services.AddHttpClient();
}
void ConfigureServices(IConfiguration configuration, IServiceCollection services)
{
ConfigureOptions(configuration, services);
ConfigureManagers(services);
}
void Configure(WebHostBuilderContext context, IApplicationBuilder app)
{
}
return PechkaProgramBuilder<Program>
.Create(args)
.ConfigureServices(ConfigureServices)
.ConfigureApp(Configure)
.Run();