graphql-endpoint-poc
This is a rough proof-of-concept of an endpoint running on a MarkLogic appServer. The endpoint accepts a graphql query string, then parses the query into a graphql AST representation of the query. The returned value is a JSON object containing the original query and a string representation of the AST.
The parser used is the parser included in the JavaScript reference implementation of GraphQl (https://github.com/graphql/graphql-js).
Quick Start
- Create the Docker container running MarkLogic
python Container/createMarkLogicContainer.py
- Wait for http://localhost:8001/ to permit login with admin/admin
- Deploy the AppServer, REST extension, and code.
./gradlew mlDeploy
- Test the endpoint using curl.
curl --digest --user admin:admin -X POST -H "Content-type: application/txt" -d '{ query { user } }' http://localhost:8003/LATEST/resources/graphql
Future Work
- Transform the GraphQL AST into an Optic AST.
- Use the Optic AST to run an Optic query in MarkLogic.
- Transform the Optic query results into GraphQL results and return those results to the caller.