diff --git a/EnvelopeGenerator.GeneratorAPI/Controllers/ConfigController.cs b/EnvelopeGenerator.GeneratorAPI/Controllers/ConfigController.cs new file mode 100644 index 00000000..2bc35c64 --- /dev/null +++ b/EnvelopeGenerator.GeneratorAPI/Controllers/ConfigController.cs @@ -0,0 +1,29 @@ +using EnvelopeGenerator.GeneratorAPI.Models.Annotation; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Options; + +namespace EnvelopeGenerator.GeneratorAPI.Controllers; + +/// +/// Exposes configuration data required by the client applications. +/// +/// +/// Initializes a new instance of . +/// +[Route("api/[controller]")] +[ApiController] +[Authorize] +public class ConfigController(IOptionsMonitor annotationParamsOptions) : ControllerBase +{ + private readonly AnnotationParams _annotationParams = annotationParamsOptions.CurrentValue; + + /// + /// Returns annotation configuration that was previously rendered by MVC. + /// + [HttpGet("Annotations")] + public IActionResult GetAnnotationParams() + { + return Ok(_annotationParams.AnnotationJSObject); + } +}