34 lines
1.0 KiB
C#
34 lines
1.0 KiB
C#
using JOBot.Backend.DAL.Context;
|
|
using JOBot.Backend.Infrastructure.Config;
|
|
using JOBot.Backend.Services;
|
|
using JOBot.Backend.Services.gRPC;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace JOBot.Backend;
|
|
|
|
public class Startup(IConfiguration configuration)
|
|
{
|
|
private IConfiguration Configuration { get; } = configuration;
|
|
|
|
public void ConfigureServices(IServiceCollection services)
|
|
{
|
|
services.AddGrpc();
|
|
services.AddGrpcReflection();
|
|
services.AddControllers();
|
|
services.AddLogging();
|
|
|
|
services.AddDbContext<AppDbContext>(options =>
|
|
options.UseNpgsql(Configuration.GetConnectionString("PostgreSQL")));
|
|
|
|
services.Configure<HeadHunterConfig>(Configuration.GetSection(HeadHunterConfig.SectionName));
|
|
|
|
services.AddScoped<HeadHunterService>();
|
|
}
|
|
|
|
public void Configure(WebApplication app, IWebHostEnvironment env)
|
|
{
|
|
app.MapGrpcReflectionService().AllowAnonymous();
|
|
app.MapGrpcService<UserService>();
|
|
app.MapControllers();
|
|
}
|
|
} |