Last active
December 4, 2020 23:25
-
-
Save xperiandri/c24c17c1570866ac8aba34bd63d2572e to your computer and use it in GitHub Desktop.
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
let handleRequest (serviceProvider : IServiceProvider) (requestBodyStream : Stream) = async { | |
... | |
try | |
... | |
let! result = | |
match request with | |
| ValueSome (query, ValueSome variables) -> | |
async { | |
let query = removeWhitespacesAndLineBreaks query | |
let root = serviceProvider.GetRequiredService<Root>() | |
let! result = Schema.executor.AsyncExecute (query, root, variables) | |
return result | |
} | |
| ValueSome (query, ValueNone) -> | |
async { | |
let query = removeWhitespacesAndLineBreaks query | |
let root = serviceProvider.GetRequiredService<Root>() | |
let! result = Schema.executor.AsyncExecute(query, root) | |
return result | |
} | |
| ValueNone -> | |
Schema.executor.AsyncExecute(Introspection.IntrospectionQuery) | |
return result | |
with | ex -> | |
log.LogError ("Exception! {message}", ex.Message) | |
let result = GQLResponse.Error (ex.Message, Metadata.Empty) | |
return result | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment