first commit
This commit is contained in:
31
backend/Controllers/ConfigController.cs
Normal file
31
backend/Controllers/ConfigController.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using backend.Models;
|
||||
|
||||
namespace backend.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class ConfigController : ControllerBase
|
||||
{
|
||||
private readonly AppConfig _appConfig;
|
||||
|
||||
public ConfigController(IOptions<AppConfig> appConfig)
|
||||
{
|
||||
_appConfig = appConfig.Value;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult GetConfig()
|
||||
{
|
||||
return Ok(new
|
||||
{
|
||||
siteTitle = _appConfig.SiteTitle,
|
||||
subtitle = _appConfig.Subtitle,
|
||||
channels = _appConfig.Channels.Select(c => new { name = c.Name, url = c.Url }),
|
||||
shortText = _appConfig.ShortText,
|
||||
quizParticipationPoints = _appConfig.Quiz.ParticipationPoints,
|
||||
quizCorrectAnswerPoints = _appConfig.Quiz.CorrectAnswerPoints
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user