Hacker News new | past | comments | ask | show | jobs | submit login

Hi - you can make a relationship using the built in addon package, github.com/bosssauce/reference

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.




Ahh, okay. That seems straightforward. Might be good to reference that in the main documentation.


Definitely will -- thank you for taking the time to read through.. it's hard for me to know where the docs are too light sometimes. (besides generally everywhere)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: