Closed namenu closed 4 months ago
Typically, a GraphQL endpoint (say, via lacinia-pedestal) is exposed as using the POST method (not GET, which lacinia-pedestal only supports as a legacy option, as it involves a gigantic query variable). If you want to expose queries using GET and mutations using POST, that can be done in a number of ways; I would suggest having multiple compiled schemas ... this is an area where being able to treat the schema as data is valuable, as you can have a full schema and a stripped-down schema and compile each of them, and build two endpoints around them separately.
However, at its core, lacinia doesn't know about the transport layer, where concerns such as HTTP method come from; so at the very least, a discussion of this belongs in lacinia-pedestal.
Fair enough. Thanks!
According to the graphql-http specification, queries passed in GET requests should not allow mutation.
We can do this by adding
:read-only?
(default false) to :options, and determining theoperation-type
from the result ofparse-query
.For example: