aboutsummaryrefslogtreecommitdiff
path: root/dropped/docker/crupest-api/CrupestApi/CrupestApi.Todos/TodosWebApplicationExtensions.cs
diff options
context:
space:
mode:
Diffstat (limited to 'dropped/docker/crupest-api/CrupestApi/CrupestApi.Todos/TodosWebApplicationExtensions.cs')
-rw-r--r--dropped/docker/crupest-api/CrupestApi/CrupestApi.Todos/TodosWebApplicationExtensions.cs32
1 files changed, 0 insertions, 32 deletions
diff --git a/dropped/docker/crupest-api/CrupestApi/CrupestApi.Todos/TodosWebApplicationExtensions.cs b/dropped/docker/crupest-api/CrupestApi/CrupestApi.Todos/TodosWebApplicationExtensions.cs
deleted file mode 100644
index 0ff05a0..0000000
--- a/dropped/docker/crupest-api/CrupestApi/CrupestApi.Todos/TodosWebApplicationExtensions.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using CrupestApi.Commons;
-
-namespace CrupestApi.Todos;
-
-public static class TodosWebApplicationExtensions
-{
- public static WebApplication MapTodos(this WebApplication app, string path)
- {
- if (app is null)
- {
- throw new ArgumentNullException(nameof(app));
- }
-
- app.MapGet(path, async (context) =>
- {
- var todosService = context.RequestServices.GetRequiredService<TodosService>();
-
- try
- {
- var todos = await todosService.GetTodosAsync();
- await context.Response.WriteJsonAsync(todos);
-
- }
- catch (Exception e)
- {
- await context.Response.WriteMessageAsync(e.Message, statusCode: StatusCodes.Status503ServiceUnavailable);
- }
- });
-
- return app;
- }
-} \ No newline at end of file