fantomas
This commit is contained in:
parent
fd0dd2b18e
commit
7765f84b03
29
.editorconfig
Normal file
29
.editorconfig
Normal file
@ -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
|
||||||
22
Client.fs
22
Client.fs
@ -12,27 +12,19 @@ module Client =
|
|||||||
// and refresh your browser, no need to recompile unless you add or remove holes.
|
// and refresh your browser, no need to recompile unless you add or remove holes.
|
||||||
type IndexTemplate = Template<"wwwroot/index.html", ClientLoad.FromDocument>
|
type IndexTemplate = Template<"wwwroot/index.html", ClientLoad.FromDocument>
|
||||||
|
|
||||||
let People =
|
let People = ListModel.FromSeq [ "John"; "Paul" ]
|
||||||
ListModel.FromSeq [
|
|
||||||
"John"
|
|
||||||
"Paul"
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
[<SPAEntryPoint>]
|
[<SPAEntryPoint>]
|
||||||
let Main () =
|
let Main () =
|
||||||
let newName = Var.Create ""
|
let newName = Var.Create ""
|
||||||
|
|
||||||
IndexTemplate.Main()
|
IndexTemplate
|
||||||
.ListContainer(
|
.Main()
|
||||||
People.View.DocSeqCached(fun (name: string) ->
|
.ListContainer(People.View.DocSeqCached (fun (name: string) -> IndexTemplate.ListItem().Name(name).Doc ()))
|
||||||
IndexTemplate.ListItem().Name(name).Doc()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.Name(newName)
|
.Name(newName)
|
||||||
.Add(fun _ ->
|
.Add(fun _ ->
|
||||||
People.Add(newName.Value)
|
People.Add newName.Value
|
||||||
newName.Value <- ""
|
newName.Value <- "")
|
||||||
)
|
.Doc ()
|
||||||
.Doc()
|
|
||||||
|> Doc.RunById "main"
|
|> Doc.RunById "main"
|
||||||
|
|||||||
35
Startup.fs
35
Startup.fs
@ -8,33 +8,34 @@ open web_api_cookbook
|
|||||||
|
|
||||||
[<EntryPoint>]
|
[<EntryPoint>]
|
||||||
let main args =
|
let main args =
|
||||||
let builder = WebApplication.CreateBuilder(args)
|
let builder = WebApplication.CreateBuilder (args)
|
||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
builder.Services.AddWebSharper()
|
builder.Services.AddWebSharper().AddAuthentication("WebSharper").AddCookie ("WebSharper", fun options -> ())
|
||||||
.AddAuthentication("WebSharper")
|
|
||||||
.AddCookie("WebSharper", fun options -> ())
|
|
||||||
|> ignore
|
|> ignore
|
||||||
|
|
||||||
let app = builder.Build()
|
let app = builder.Build ()
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
if not (app.Environment.IsDevelopment()) then
|
if not (app.Environment.IsDevelopment ()) then
|
||||||
app.UseExceptionHandler("/Error")
|
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.
|
// 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
|
|> ignore
|
||||||
|
|
||||||
app.UseHttpsRedirection()
|
app
|
||||||
#if DEBUG
|
.UseHttpsRedirection()
|
||||||
|
#if DEBUG
|
||||||
.UseWebSharperScriptRedirect(startVite = true)
|
.UseWebSharperScriptRedirect(startVite = true)
|
||||||
#endif
|
#endif
|
||||||
.UseDefaultFiles()
|
.UseDefaultFiles()
|
||||||
.UseStaticFiles()
|
.UseStaticFiles()
|
||||||
//Enable if you want to make RPC calls to server
|
.UseHttpsRedirection ()
|
||||||
//.UseWebSharperRemoting()
|
//Enable if you want to make RPC calls to server
|
||||||
|> ignore
|
//.UseWebSharperRemoting()
|
||||||
|
|> ignore
|
||||||
app.Run()
|
|
||||||
|
app.Run ()
|
||||||
|
|
||||||
0 // Exit code
|
0 // Exit code
|
||||||
|
|||||||
@ -3,4 +3,4 @@
|
|||||||
"UseDownloadedResources": false,
|
"UseDownloadedResources": false,
|
||||||
"DebugScriptRedirectUrl": "http://localhost:56440"
|
"DebugScriptRedirectUrl": "http://localhost:56440"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user