Remove caching; add previous/next puzzle dates to puzzles
This commit is contained in:
19
Program.cs
19
Program.cs
@@ -1,5 +1,6 @@
|
||||
using ConnectionsAPI.Config;
|
||||
using ConnectionsAPI.Database;
|
||||
using ConnectionsAPI.Database.Repository;
|
||||
using ConnectionsAPI.Utility;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Net;
|
||||
@@ -8,6 +9,8 @@ namespace ConnectionsAPI
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
const string CorsPolicyName = "DefaultCorsPolicy";
|
||||
|
||||
public static async Task Main(string[] args)
|
||||
{
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
@@ -36,8 +39,21 @@ namespace ConnectionsAPI
|
||||
|
||||
builder.Services.AddLazyCache();
|
||||
|
||||
builder.Services.AddScoped<PuzzleRepository>();
|
||||
|
||||
builder.Services.AddHostedService<SyncScheduler>();
|
||||
|
||||
// configure clors
|
||||
builder.Services.AddCors(config =>
|
||||
{
|
||||
config.AddPolicy(CorsPolicyName, policy =>
|
||||
{
|
||||
policy.AllowAnyOrigin();
|
||||
policy.AllowAnyHeader();
|
||||
policy.WithMethods("GET");
|
||||
});
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
var logger = app.Services.GetRequiredService<ILogger<Program>>();
|
||||
@@ -88,6 +104,9 @@ namespace ConnectionsAPI
|
||||
}
|
||||
}
|
||||
|
||||
// enable cors
|
||||
app.UseCors(CorsPolicyName);
|
||||
|
||||
app.Run();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user