Compare commits

2 Commits
main ... OED-1

Author SHA1 Message Date
c8347ac96b Removed boilerplate 2026-03-09 17:24:13 +01:00
1fe15e107e Added PostgreSQL and Redis to the docker compose 2026-03-09 17:24:04 +01:00
3 changed files with 41 additions and 55 deletions

View File

@@ -1,48 +1,21 @@
namespace OED.Api;
var builder = WebApplication.CreateBuilder(args);
public class Program
// Add services to the container.
builder.Services.AddAuthorization();
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
builder.Services.AddOpenApi();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
app.MapOpenApi();
}
// Add services to the container.
builder.Services.AddAuthorization();
app.UseHttpsRedirection();
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
builder.Services.AddOpenApi();
app.UseAuthorization();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.MapOpenApi();
}
app.UseHttpsRedirection();
app.UseAuthorization();
var summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
app.MapGet("/weatherforecast", (HttpContext httpContext) =>
{
var forecast = Enumerable.Range(1, 5).Select(index =>
new WeatherForecast
{
Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = summaries[Random.Shared.Next(summaries.Length)]
})
.ToArray();
return forecast;
})
.WithName("GetWeatherForecast");
app.Run();
}
}
app.Run();

View File

@@ -1,12 +0,0 @@
namespace OED.Api;
public class WeatherForecast
{
public DateOnly Date { get; set; }
public int TemperatureC { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
public string? Summary { get; set; }
}

25
docker-compose.yml Normal file
View File

@@ -0,0 +1,25 @@
services:
postgres:
image: postgres:latest
restart: unless-stopped
environment:
POSTGRES_USER: oed
POSTGRES_PASSWORD: devpassword
POSTGRES_DB: oed
ports:
- "5432:5432"
volumes:
- postgres:/var/lib/postgresql
redis:
image: redis:latest
restart: unless-stopped
command: redis-server --requirepass devpassword
ports:
- "6379:6379"
volumes:
- redis:/data
volumes:
postgres:
redis: