Skip to content

Commit 19290a4

Browse files
Added Playground and voyager for LHK-542
1 parent bd8fa09 commit 19290a4

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

Packages.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
<PackageReference Update="EntityFramework" Version="1.*" />
3939
<PackageReference Update="FSharp.Data.TypeProviders" Version="1.*" />
4040
<PackageReference Update="Giraffe" Version="6.*" />
41+
<PackageReference Update="GraphQL.Server.Ui.Playground" Version="7.1.*" />
42+
<PackageReference Update="GraphQL.Server.Ui.Voyager" Version="7.1.*" />
4143
<PackageReference Update="Iced" Version="1.17.*" />
4244
<PackageReference Update="Microsoft.CodeCoverage" Version="17.3.*" />
4345
<PackageReference Update="Microsoft.Diagnostics.NETCore.Client" Version="0.2.*" />

samples/star-wars-api/FSharp.Data.GraphQL.Samples.StarWarsApi.fsproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
<ItemGroup>
1010
<PackageReference Include="Giraffe" />
1111
<PackageReference Include="Newtonsoft.Json" />
12+
<PackageReference Include="GraphQL.Server.Ui.Playground" />
13+
<PackageReference Include="GraphQL.Server.Ui.Voyager" />
1214
</ItemGroup>
1315

1416
<ItemGroup>

samples/star-wars-api/Startup.fs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
namespace FSharp.Data.GraphQL.Samples.StarWarsApi
22

33
open Microsoft.AspNetCore.Builder
4+
open Microsoft.AspNetCore.Server.Kestrel.Core
45
open Microsoft.Extensions.Configuration
56
open Microsoft.Extensions.DependencyInjection
6-
open Giraffe
7+
open Microsoft.Extensions.Hosting
78
open Microsoft.Extensions.Logging
9+
open Giraffe
810
open System
9-
open Microsoft.AspNetCore.Server.Kestrel.Core
1011

1112
type Startup private () =
1213
new (configuration: IConfiguration) as this =
@@ -19,10 +20,15 @@ type Startup private () =
1920
.Configure(Action<IISServerOptions>(fun x -> x.AllowSynchronousIO <- true))
2021
|> ignore
2122

22-
member _.Configure(app: IApplicationBuilder) =
23+
member _.Configure(app: IApplicationBuilder, env: IHostEnvironment) =
2324
let errorHandler (ex : Exception) (log : ILogger) =
2425
log.LogError(EventId(), ex, "An unhandled exception has occurred while executing the request.")
2526
clearResponse >=> setStatusCode 500
27+
28+
if env.IsDevelopment() then
29+
app.UseGraphQLPlayground("/") |> ignore
30+
app.UseGraphQLVoyager("/LaunchUrl") |> ignore
31+
2632
app
2733
.UseGiraffeErrorHandler(errorHandler)
2834
.UseWebSockets()

0 commit comments

Comments
 (0)