diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..21c68e2 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,29 @@ +root = true + +# All files +[*] +indent_style = space + +# Xml files +[*.xml] +indent_size = 2 + +[*.fs] +fsharp_space_before_uppercase_invocation = true + +# Write a comment by starting the line with a '#' +[*.{fs,fsx,fsi}] +fsharp_bar_before_discriminated_union_declaration = true +max_line_length = 120 + +# C# files +[*.cs] + +#### Core EditorConfig Options #### + +# Indentation and spacing +indent_size = 4 +tab_width = 4 + +# New line preferences +insert_final_newline = false \ No newline at end of file diff --git a/Client.fs b/Client.fs index 32483c4..ae72468 100644 --- a/Client.fs +++ b/Client.fs @@ -12,27 +12,19 @@ module Client = // and refresh your browser, no need to recompile unless you add or remove holes. type IndexTemplate = Template<"wwwroot/index.html", ClientLoad.FromDocument> - let People = - ListModel.FromSeq [ - "John" - "Paul" - ] + let People = ListModel.FromSeq [ "John"; "Paul" ] [] let Main () = let newName = Var.Create "" - IndexTemplate.Main() - .ListContainer( - People.View.DocSeqCached(fun (name: string) -> - IndexTemplate.ListItem().Name(name).Doc() - ) - ) + IndexTemplate + .Main() + .ListContainer(People.View.DocSeqCached (fun (name: string) -> IndexTemplate.ListItem().Name(name).Doc ())) .Name(newName) .Add(fun _ -> - People.Add(newName.Value) - newName.Value <- "" - ) - .Doc() + People.Add newName.Value + newName.Value <- "") + .Doc () |> Doc.RunById "main" diff --git a/Startup.fs b/Startup.fs index 9088832..00834cb 100644 --- a/Startup.fs +++ b/Startup.fs @@ -8,33 +8,34 @@ open web_api_cookbook [] let main args = - let builder = WebApplication.CreateBuilder(args) - + let builder = WebApplication.CreateBuilder (args) + // Add services to the container. - builder.Services.AddWebSharper() - .AddAuthentication("WebSharper") - .AddCookie("WebSharper", fun options -> ()) + builder.Services.AddWebSharper().AddAuthentication("WebSharper").AddCookie ("WebSharper", fun options -> ()) |> ignore - let app = builder.Build() + let app = builder.Build () // Configure the HTTP request pipeline. - if not (app.Environment.IsDevelopment()) then - app.UseExceptionHandler("/Error") + if not (app.Environment.IsDevelopment ()) then + app + .UseExceptionHandler("/Error") // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. - .UseHsts() + .UseHsts () |> ignore - - app.UseHttpsRedirection() -#if DEBUG + + app + .UseHttpsRedirection() +#if DEBUG .UseWebSharperScriptRedirect(startVite = true) #endif .UseDefaultFiles() .UseStaticFiles() - //Enable if you want to make RPC calls to server - //.UseWebSharperRemoting() - |> ignore - - app.Run() + .UseHttpsRedirection () + //Enable if you want to make RPC calls to server + //.UseWebSharperRemoting() + |> ignore + + app.Run () 0 // Exit code diff --git a/appsettings.json b/appsettings.json index 6c2d447..2f7b664 100644 --- a/appsettings.json +++ b/appsettings.json @@ -3,4 +3,4 @@ "UseDownloadedResources": false, "DebugScriptRedirectUrl": "http://localhost:56440" } -} \ No newline at end of file +}