begin new and last rework

This commit is contained in:
2024-07-18 14:44:29 +02:00
parent abfc997ac1
commit 1a976fc9ef
26 changed files with 444 additions and 101 deletions

View File

@@ -0,0 +1,25 @@
namespace OwnChar.ServerNew.Api.Endpoint;
internal class ApiBuilder(WebApplication app) : IApiBuilder
{
public void Map(string method, string pattern, Delegate action)
{
if (method == ApiRequestMethods.Get)
app.MapGet(pattern, action);
else if (method == ApiRequestMethods.Post)
app.MapPost(pattern, action);
else if (method == ApiRequestMethods.Put)
app.MapPut(pattern, action);
else if (method == ApiRequestMethods.Patch)
app.MapPatch(pattern, action);
else if (method == ApiRequestMethods.Delete)
app.MapDelete(pattern, action);
else
throw new NotSupportedException();
}
public void Map(string pattern, Delegate action)
{
app.Map(pattern, action);
}
}