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

42 lines
1.2 KiB
C#
Raw Permalink Normal View History

2023-07-02 18:06:26 +03:00
// See https://aka.ms/new-console-template for more information
2023-07-02 19:21:42 +03:00
using Keroosha.Pechka.Web.Database;
2023-07-02 18:47:51 +03:00
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)
{
2023-07-02 19:21:42 +03:00
services.AddDbContextManager((z, x) => new AppDbContextManager(z, x));
2023-07-02 18:47:51 +03:00
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();