Open joncursi opened 8 years ago
I'm using that structure and getting ssr - the only difference is importing the applicable client stuff (ie routes) in the server startup file
On Sat, Apr 9, 2016, 11:45 Jon Cursi notifications@github.com wrote:
Meteor recommends a particular structure when structuring your application, which places routes.js inside the imports directory and all components within a ui directory. This seems to break flow router's SSR support, which requires that these files be available on both the client and server.
It is possible to have SSR support without changing Meteor's preferred app structure? Thanks!
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/kadirahq/flow-router/issues/591
@joncursi - I think the trick is (unlike the todos sample) to not import the templates in routes.js
. Then you can include routes.js
on both the client and server side. I created a startup/both
directory and put it there with other things that would have been in lib
in the old structure. I then include those files on both the client and server. On the client, then, you have to remember to import the template routes that you took out of routes.js
somewhere else.
I maintained Meteor 1.3 structure, but have startup/both/routes.jsx
that I import to both startup/client
and startup/server
. Not sure if best practise, but it does the job.
I think that routes for server side render must be defined in both client and server. The others can be defined only in client.
Meteor recommends a particular structure when structuring your application, which places
routes.js
inside theimports
directory and all components within aui
directory. See http://guide.meteor.com/structure.html#example-app-structureThis structure seems to break flow router's SSR support, which requires that these files be available on both the client and server in a
lib
orapp
directory. It is possible to have SSR support without changing Meteor's preferred app structure? Thanks!