Re:Ponzu – An open-source HTTP server framework and CMS in Go
by tyingq on Sunday April 09, 2017 @08:50PM
(#14075205)
Ahh, okay. That seems straightforward. Might be good to reference that in the main documentation.
The reference is stored as a string (or []string if you opt for a reference.SelectRepeater input func), but the value stored as a reference is actually a URL path to the content as it would be accessed via the Content API. This becomes very powerful when you enable HTTP/2 Server Push, and declare the referenced content to be pushed when it's parent content is requested.
The underlying data looks like this:
Song
id: 1
title: "Take Me Home, Country Roads"
artist: "/api/content?type=Artist&id=2"
If you enable H2 Server Push by implementing the Pushable interface (add a Push method that returns a []string of the JSON field names to push), the server will know to make a response for the referenced Artist field and push it down to the client when the parent Song is requested.