1
0
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
831 B

using PhilExampleCrawler.Common.Models;
using WebAPI.Interfaces;
using WebAPI.Services;
var builder = WebApplication.CreateBuilder(args);
//Configuring Services
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddSingleton<ICrawlScheduler<List<Insertion>>, CrawlScheduler<List<Insertion>>>();
builder.Services.AddSingleton<ITelegramDistributer, TelegramDistributer>();
builder.Services.AddHostedService(provider => provider.GetService<ITelegramDistributer>());
builder.Services.AddHttpClient();
var app = builder.Build();
//Configuring HTTP request pipeline
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
else
{
app.UseHttpsRedirection();
}
app.UseAuthorization();
app.MapControllers();
app.Run();