From 17c20608a801e41158f0daa05ee79e1777c0507d Mon Sep 17 00:00:00 2001 From: Ayrat Hudaygulov Date: Mon, 25 Dec 2023 17:40:01 +0000 Subject: [PATCH] updates routes to enable GET -> OK on any route --- src/VahterBanBot/Program.fs | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/VahterBanBot/Program.fs b/src/VahterBanBot/Program.fs index 6f4b2b8..1699cd2 100644 --- a/src/VahterBanBot/Program.fs +++ b/src/VahterBanBot/Program.fs @@ -99,21 +99,19 @@ getEnvWith "APPLICATIONINSIGHTS_CONNECTION_STRING" (fun appInsightKey -> %builder.Logging.AddConsole() let webApp = choose [ - // need for Azure health checks on / route - GET >=> route "/" >=> text "OK" - - requiresApiKey >=> choose [ - POST >=> route botConf.Route >=> bindJson (fun update next ctx -> task { - use scope = ctx.RequestServices.CreateScope() - let telegramClient = scope.ServiceProvider.GetRequiredService() - let logger = ctx.GetLogger() - try - do! onUpdate telegramClient botConf (ctx.GetLogger "VahterBanBot.Bot") update.Message - with e -> - logger.LogError(e, "Unexpected error while processing update") - return! Successful.OK() next ctx - }) - ] + // need for Azure health checks on any route + GET >=> text "OK" + + POST >=> route botConf.Route >=> requiresApiKey >=> bindJson (fun update next ctx -> task { + use scope = ctx.RequestServices.CreateScope() + let telegramClient = scope.ServiceProvider.GetRequiredService() + let logger = ctx.GetLogger() + try + do! onUpdate telegramClient botConf (ctx.GetLogger "VahterBanBot.Bot") update.Message + with e -> + logger.LogError(e, "Unexpected error while processing update") + return! Successful.OK() next ctx + }) ] let app = builder.Build()