aboutsummaryrefslogtreecommitdiffstats
path: root/src/Program.cs
blob: 7fd2903bc901a395b341a131aa30269e8eb6057b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
global using I2R.LightNews.Services;
global using I2R.LightNews.Models;
global using IOL.Helpers;
using System.Text.Json.Serialization;
using I2R.LightNews;
using Microsoft.AspNetCore.Http.Json;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddHttpClient<NrkRadioService>();
builder.Services.AddHttpClient<NrkNewsService>();
builder.Services.AddMemoryCache();
builder.Services.AddScoped<NrkNewsService>();
builder.Services.AddScoped<NrkRadioService>();
builder.Services.Configure<JsonOptions>(options => {
    options.SerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.Never;
    options.SerializerOptions.PropertyNameCaseInsensitive = true;
});
builder.Services.AddControllers();
builder.Services.AddRazorPages().AddRazorRuntimeCompilation();

var app = builder.Build();

app.UseStaticFiles();
app.UseStatusCodePages();
app.UseRouting();
app.MapRazorPages();
app.MapControllers();
RadioIndexDb.CreateIfNotExists();
app.Run();