Can we use LiteFS with GraphQL server?

Hi. is it possible to use LiteFS with a GraphQL server? Since it’s more common to include GraphQL queries in the body of a POST request, I’m wondering how to route every read and write request to the correct nodes

Hi @sahidrahman

It should be possible, but you may need to do your own routing. LiteFS builtin proxy is quite simple and only looks at HTTP verbs, so if you use it, all POST requests will get routed to the primary node.

LiteFS replica nodes expose the hostname of the primary node at <litefs mount dir>/.primary file. So I think it should be possible to route GraphQL mutations to the primary node and serve GraphQL queries from local nodes.

The actual implementation will probably depend a lot on the language/framework that you use.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.