Skip to content

Commit

Permalink
Updated to Giraffe from latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
Henrik Kirk committed Nov 19, 2024
1 parent 35009f6 commit 21745e5
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions slides/09/giraffe.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,13 @@ type HttpHandler = HttpFunc -> HttpContext -> HttpFuncResult
```fsharp [7-8]
[<EntryPoint>]
let main _ =
Host.CreateDefaultBuilder()
.ConfigureWebHostDefaults(
fun webHostBuilder ->
webHostBuilder
.Configure(configureApp)
.ConfigureServices(configureServices)
|> ignore)
.Build()
.Run()
let builder = WebApplication.CreateBuilder(args)
configureServices builder.Services
let app = builder.Build()
configureApp app
app.Run()
0
```

Expand All @@ -83,13 +81,16 @@ let main _ =
```fsharp
let webApp = ...
let configureApp (app : IApplicationBuilder) =
let configureServices (services: IServiceCollection) =
// Add Giraffe to the ASP.NET Core pipeline
app.UseGiraffe webApp
services.AddGiraffe() |> ignore
let notFoundHandler = "Not Found" |> text |> RequestErrors.notFound
let configureServices (services : IServiceCollection) =
let configureApp (appBuilder: IApplicationBuilder) =
appBuilder
// Add Giraffe dependencies
services.AddGiraffe() |> ignore
.UseGiraffe(notFoundHandler)
```

---
Expand Down

0 comments on commit 21745e5

Please sign in to comment.