Best way to pass backend data to SSR rendered view?
Looking for the "proper" way to pass data to an SSR rendered view.
My first idea is setting custom properties on the window object. Is there any standard?
I use Oak as a backend
I know frameworks such as Express have a render method that can do that, but I don't know what it's doing under the hood.
Oak does have a context.state object that, according to the docs should be able to send data to the frontend view, but I cannot find the data on the frontend. Whether it be in the http response
4 Replies
The browser receives the HTML (if any) send by oak. Any data you want to share needs to be in that HTML
Of course I know that. I wonder what's the proper way to store the data
I think you might want to look at using this view engine library with Oak - IDK if Oak actually has a feature like the
render
function of Express: https://deno.land/x/view_engine@v10.6.0