Working with GraphQL
The first thing you need in order to be able to display content on a page is a JSON structure that contains all the data you need. The Cook obtains this data by executing a GraphQL query that retrieves the required data from the Content Engine's web service. You can see how this works by opening a browser and submitting a request directly to the Cook instead of to the demo publication URL.
If you have installed the DPRES components as described in
Quick Start Using Docker or
Bare Metal Installation, then the Waiter
will be listening for requests on port 8100, and the Cook will be
listening for requests on port 8101. This means the URL of the demo
publication's front page is
http://
dpres-host:8100/
.
If you want to see the Cook's version of the same page, simply change
the port number in the URL to 8101 and add the name of the publication:
http://
dpres-host:8101/dpres-demo/
(make sure you include the final slash). The Cook will then return the
JSON data from which Waiter generates the front page:
{"data":{"resolution":{"context":"sec","remainingPath":"","publicationName":"dpres-demo","sectionUniqueName":"ece_frontpage"}, "context":{"name":"frontpage","section":{"href":"http://edemo-dev:8081/dpres-demo/"},"rootGroup":{"top":[{"display":"", "content":{"id":"2002","href":"http://edemo-dev:8081/dpres-demo/science/2016-12-14/Mercury-pollution-risk-to-Arctic-gull-2002.html", ...etc...
A much more useful way to view the JSON data is to use the Cook's The GraphiQL Editor interface.
If you have installed DPRES on a Windows machine using Docker, then
replace dpres-host in the above URLs with
the IP address of your Docker virtual machine. Otherwise, replace it
with localhost
.