Skip to content

Instantly share code, notes, and snippets.

@pkese
Last active August 19, 2022 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pkese/4753caf10572dcdf6d58d6d22111c8f5 to your computer and use it in GitHub Desktop.
Save pkese/4753caf10572dcdf6d58d6d22111c8f5 to your computer and use it in GitHub Desktop.
OOP style minimal API formatting
open System
open Microsoft.AspNetCore.Builder
open Microsoft.Extensions.Hosting
open Microsoft.Extensions.DependencyInjection
[<EntryPoint>]
let main args =
let builder = WebApplication.CreateBuilder(args)
builder
.Services
.AddGraphQLServer()
.AddQueryType<Camara.Schema.CamaraQuery>()
let app =
builder
.Build()
.MapGet("/", Func<string>(fun () -> "Hello World!"))
.UseRouting()
.UseEndpoints(
fun endpoints -> endpoints.MapGraphQL() |> ignore )
.Run()
0 // Exit code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment