D
Deno

help

Best way to pass backend data to SSR rendered view?

T.topy8/7/2023
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
Mmarvinh.8/7/2023
The browser receives the HTML (if any) send by oak. Any data you want to share needs to be in that HTML
T.topy8/7/2023
Of course I know that. I wonder what's the proper way to store the data
KWKevin Whinnery8/7/2023
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
KWKevin Whinnery8/7/2023
No description

Looking for more? Join the community!