Add remaining project files
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using static DeluxeBackend.Enums;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace DeluxeBackend.Controllers.Api
|
||||
{
|
||||
[Route("api/gameconfigs")]
|
||||
[ApiController]
|
||||
public class GameConfigsController : ControllerBase
|
||||
{
|
||||
private readonly List<GameConfigDto> gameConfigDtos = [];
|
||||
|
||||
public GameConfigsController()
|
||||
{
|
||||
if (gameConfigDtos.Count == 0)
|
||||
{
|
||||
var json = System.IO.File.ReadAllText(Path.Combine("data", "GameConfigs.json"));
|
||||
var gameConfigs = JsonSerializer.Deserialize<List<GameConfigDto>>(json);
|
||||
gameConfigDtos.AddRange(gameConfigs);
|
||||
}
|
||||
}
|
||||
public class GameConfigDto
|
||||
{
|
||||
public required string Key { get; set; }
|
||||
public required string Value { get; set; }
|
||||
public string? ActiveExperiments { get; set; } = null;
|
||||
}
|
||||
|
||||
[HttpGet("v1/all")]
|
||||
public async Task<IActionResult> List()
|
||||
{
|
||||
return Ok(gameConfigDtos);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user