Thanks for taking the time to check out the source for the GraphQL proxy I demoed for AEM Rockstar 2022. This repository is definitely in alpha stages, and is only intended as a quick proof of concept for the ability to take the existing Sling model export format and show that it could be converted easily to GraphQL. This is not production-ready code, and it would be far better to utilize the concepts shown herein directly within AEM itself, perhaps even bypassing the need to generate the .model.json
export in the first place.
To get started, ensure that you have AEM running.
The code currently defaults to http://localhost:4502
within com.bounteous.service.AEMServiceImpl
so you can change the endpoint there if needed.
You can run the project by running the WebServiceMain
class
in the test folder.
You should now be able to make graphql requests against this endpoint.
If you've previously configured the wknd-spa-react
sample,
then the following request should work for you:
curl -i -XPOST -H'Content-Type: application/json' -d'{"operationName":"PageQuery","variables":{"path":"/content/wknd-spa-react/us/en/home/browser"},"query":"query PageQuery($path: String) { pageModel(path: $path) { cssClassNames path templateName childrenPaths title type itemsOrder items { key component { ... on AEMResponsiveGrid { items { key component { ... on AEMHeader { type items { active children { active lastModified level path title url } lastModified level path title url}}}}}}}}}"}' 'http://localhost:9999/graphql'
I recommend using the graphiql browser extension for experimenting with queries.