LTV GraphQL Proof-of-Concept
This is a barebones proof-of-concept of a possible GraphQL implementation that interacts with Core. It includes a few very basic (incomplete) types to show how the GraphQL service may be a liason between mobile apps and the backend.
Files to read
In particular, you should check out:
graphql_resolvers.go
: definitions and explanations for resolver functions.graphql_schema.go
: Definition of the GraphQL schema, along with types and their associated fields.
Authentication
In a production setup, we would have nginx route the /graphql
URL to this service; we could then use the session information from the client request to authenticate with Core. In this setup, we'll need to do some manual work to simulate that setup.
- Login to production Core on a web browser.
- In the browser developer tools, copy the value of the "Cookie" header. Copy only the value, not the name.
- Paste the cookie into a file named
cookie.txt
within this directory. Make sure that the file does not include a trailing newline.
Setup
Once you've followed the Authentication instructions above, you can get this started with:
docker-compose up
Then navigate to localhost:8080 in your web browser; you'll get a form where you may enter queries and see how they'll be returned to mobile clients.
Notes
- Errors are almost entirely ignored; this is a PoC, not production ready!
- The available types are reports and basic information about the logged-in user. This is far from complete, but is meant to show a big-picture view of GraphQL in action.