-
Notifications
You must be signed in to change notification settings - Fork 0
/
Startup.fs
40 lines (33 loc) · 1.12 KB
/
Startup.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
namespace ws_1044
open System
open Microsoft.AspNetCore
open Microsoft.AspNetCore.Builder
open Microsoft.AspNetCore.Hosting
open Microsoft.AspNetCore.Http
open Microsoft.Extensions.Configuration
open Microsoft.Extensions.DependencyInjection
open WebSharper.AspNetCore
type Startup() =
member this.ConfigureServices(services: IServiceCollection) =
services.AddSitelet(Site.Main)
.AddAuthentication("WebSharper")
.AddCookie("WebSharper", fun options -> ())
|> ignore
member this.Configure(app: IApplicationBuilder, env: IHostingEnvironment) =
if env.IsDevelopment() then app.UseDeveloperExceptionPage() |> ignore
app.UseAuthentication()
.UseStaticFiles()
.UseWebSharper()
.Run(fun context ->
context.Response.StatusCode <- 404
context.Response.WriteAsync("Page not found"))
module Program =
let BuildWebHost args =
WebHost
.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build()
[<EntryPoint>]
let main args =
BuildWebHost(args).Run()
0