I recently upgraded my Node-React multi-page server-side rendered (SSR) app to use session token-based authentication.
I can run each (of several) pages of my app individually as a single-page embedded app on Shopify, but I’d like to run all of my pages within
the Shopify Embedded App using the new session tokens approach.
Two questions:
Is Turbolinks still the recommended approach, or should we be using the newer hotwired/turbo library?
Is there a node-react sample application available that uses either the Hotwired Turbolinks or Turbo library to build an embedded SSR app that supports session tokens?
Great questions here! Most of the time I would consider a ‘recommended approach’ more about opinion that can greatly vary from developer to developer based on comfort level, the stack being used in a current build, etc. Understandably examples, official libraries, and documentation can play a large part in decisions to use one tool or library over another. While the following resources both utilize and reference a Rails app, these are the most relevant docs we provide around this development topic at the moment:
Beyond that, do keep an eye out for replies or related posts from others in the community that may have additional insights or suggestions. Happy developing and hope this offers a starting point - Cheers!
For the time being, I’ve moved all of my page navigation into index.js, using React states to simulate routing.
This is not the most efficient approach, but the SSR approach with Rails & Turbolinks probably won’t work
in my case (or for the general world of Node developers).
I do like what Shopify has done with its move to JWT, and believe this was a necessary and important advancement.
It will benefit the Node development community if Shopify does publish a best practice approach for SSR / Node / React.