Open Krzysztof-Cieslak opened 6 years ago
https://github.com/fsprojects/FSharp.Data.GraphQL may be of interest here.
Also of interest: https://graphql.org/learn/serving-over-http/
Summary:
/graphql
, handles all requestsquery
required, optional parameters can include variables
(JSON-encoded string) and operationName
(a single string).application/json
content type. Body is JSON with up to three fields: query
, variables
, and operationName
.
query
is required, but might be specified in the URL query parameters rather than body; both should be accepted and handled.query
and JSON body also has a query
field. In such a case, I'd suggest going with the behavior of the express-graphql library, which uses let query = urlData.query || bodyData.query;
so that URL parameters, if specified, override the body. (Same applies to variables
and operationName
.variables
only required if query contains variables.operationName
only required if query contains multiple operations.application/graphql
content type is used instead, POST body should be considered the GraphQL query string (and variables
and operationName
, if presented, would have to be found in the URL query parameters){ "data": { ... }, "errors": [ ... ] }
. errors
field only present if there were errors, otherwise omitted. data
omitted if error happened before query execution began. If query execution started but error prevented response, data
should be present but contain null
.More formal spec: http://facebook.github.io/graphql/June2018/
3 years later, what is the recommended way of doing GraphQL with Saturn now? Is there any? Is it possible (in a production quality/setup)?
@AlexeyRaga Probably the best way right now is not to involve Saturn and use AspNetCore middleware from
You will need to experiment with these to see which one suits your needs the best
Investigate abstraction for creating GraphQL instead of REST-ish controllers.