push my ork

This commit is contained in:
2024-08-15 09:20:20 +02:00
parent decb932a1c
commit 3522aff72c
13 changed files with 100 additions and 118 deletions

View File

@@ -1,17 +1,13 @@
using OwnChar.Api.Packets;
namespace OwnChar.Server.Api.Endpoint;
namespace OwnChar.Server.Api.Endpoint;
internal class ApiBuilder(WebApplication app) : IApiBuilder
internal class ApiBuilder : IApiBuilder
{
public void MapRequest(string pattern, Delegate action)
{
Map(pattern + "/{request}", action);
}
private readonly Dictionary<ApiMapInfo, Delegate> handlers = [];
public IReadOnlyDictionary<ApiMapInfo, Delegate> Handlers => handlers;
public void Map(string pattern, Delegate action)
{
//app.Map(pattern, action);
app.MapPost(pattern, action);
handlers.Add(new(pattern, "POST"), action);
}
}