diff --git a/backend/src/Modules/Settings/Presentation/Endpoints/SettingsEndpoints.cs b/backend/src/Modules/Settings/Presentation/Endpoints/SettingsEndpoints.cs new file mode 100644 index 0000000..961865b --- /dev/null +++ b/backend/src/Modules/Settings/Presentation/Endpoints/SettingsEndpoints.cs @@ -0,0 +1,21 @@ +using Carter; +using Knot.Modules.Settings.Application.Settings.Queries; +using Knot.Shared.Kernel; +using MediatR; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Routing; + +namespace Knot.Modules.Settings.Presentation.Endpoints; + +public sealed class SettingsEndpoints : ICarterModule +{ + public void AddRoutes(IEndpointRouteBuilder app) + { + app.MapGet("api/config", async (ISender sender, CancellationToken ct) => + { + var result = await sender.Send(new GetPublicConfigQuery(), ct); + return result.IsSuccess ? Results.Ok(result.Value) : Results.BadRequest(result.Error); + }); + } +}