Hey @juan.sanchez, @marcel.overbeek
I'm not sure I fully got your question so let me break it down and tell me if that help
Regarding what you're trying to achieve, moving from some templating engine in Java to Nuxt.js + Slice Machine is definitely doable! Same goes for enriching data from Prismic in your Java backend.
One thing I would advise you to consider is to fully leverage Nuxt.js data fetching methods to perform the enrichment there. Sounds smoother to me than proxying request to Prismic through your backend, nonetheless, I suspect you may have things that you prefer to keep there, so that's up to you~
Also regarding Prismic data enrichment, I'm not sure if you're aware of that feature of not, but you can leverage Integration Fields, they can allow you to plug any catalog of yours to Prismic repositories.
Now to the issues you are facing. Not sure I fully got querying the Slice Zone in Java, but here are the basics: The Slice Zone is a part of your documents where you can compose with Slices, just like any fields in your document you can find it in the returned object, by default the default Slice Zone is at key body
.
What happens with the Nuxt Slice Zone component is that it performs a fetch to get a document in Prismic, and then feeds the array of slices at key body
to it. You can also directly supply an array of slices to the Slice Zone using the slices
props. More on using Nuxt Slice Zone here.
About Slice Zone structure and its support in our Java Kit you might find handy the Javadoc here, the Fragment.Slice
class and the ones implementing it might be what you're looking for. Here's a dummy representation of the JSON structure returned by the API of a Slice Zone:
[
{
slice_type: String,
primary: Map<String,Fragment>
items: Array<Map<String,Fragment>>
}
/* ... */
]
Voila! Hope that was helpful~
Again I'm really suggesting you to consider not proxying Prismic API through your backend as this might lead to some issues, especially with previews, and again here the Javadoc.