using Nancy; using Nancy.Extensions; namespace File_Watcher.NancyModules; public class SyncModule : NancyModule { public SyncModule() { Get("/bob/v1/sync/", _ => { string? result; try { string query = Request.Url.Query; IDictionary> collection = Nancy.Helpers.HttpUtility.ParseQueryString(query).ToDictionary(); result = collection is null ? "null" : collection.ToString(); } catch (Exception ex) { result = ex.Message; } return result; }); Post("/bob/v1/sync/", _ => { string result; // Notification notification; // ILog log = LogManager.GetLogger(typeof(SyncModule)); // log.Info($"Enter-{nameof(Post)}"); try { string body = Request.Body.AsString(); DynamicDictionary form = Request.Form; Dictionary keyValuePairs = form.ToDictionary(); string reply = Helpers.SyncHelper.GetReply(body, keyValuePairs); result = reply; } catch (Exception ex) { // log.Fatal($"Exception-{nameof(Post)}{Environment.NewLine}{ex.Message}{Environment.NewLine}{Environment.NewLine}{ex.StackTrace}"); result = ex.Message; throw; } // log.Info($"Return-{nameof(Post)}"); return result; }); } }