I'd like to expose a route to my site,
animals.example.com/book, that shows all content of pages and descendants specified in a query parameter.
For example, if my page structure is
intro pets dogs cats farm-animals cows chickens sheep wild-animals predators wolves coyotes ruminants deer rabbits appendix average-weights faq common-myths
I would like the endpoint
to render, in order, the content of these pages:
If the query parameter is omitted, the entire site should be rendered.
What functions or queries are required to accomplish this, and where should this logic hook into WordPress?