Last active
August 19, 2022 19:08
-
-
Save pkese/4753caf10572dcdf6d58d6d22111c8f5 to your computer and use it in GitHub Desktop.
OOP style minimal API formatting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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