ssrwpo / ssr

SSR - Router with SSR for Node & Meteor
https://ssrwpo.github.io/ssr/
MIT License
93 stars 16 forks source link

How to get route based data, on the server? #52

Closed s7dhansh closed 7 years ago

s7dhansh commented 7 years ago

I think it is not possible now with this package, but can someone guide me if there is any way to do it. I mean the basic approach from scratch, as I am unable to get my head towards it. If I am able to do it, I would be willing to contribute a PR too.

cbilotta commented 7 years ago

Hello, You need to use the develop branch for this! It's not released as a package yet but it's pretty stable, I use it personally in production.

s7dhansh commented 7 years ago

Ok will check. Can you give me some pointers on how to use it?

cbilotta commented 7 years ago

Basically : 1) Create a "packages" folder in the root of your project. 2) cd packages 3) git clone -b develop https://github.com/ssrwpo/ssr.git 4) mv ssr/src ./src && rm -rf ssr && mv src ssr

You are done :)

cbilotta commented 7 years ago

And you can check the demos in the develop branch to understand it better :

1) git clone -b develop https://github.com/ssrwpo/ssr.git 2) cd ssr/demo 3) meteor yarn install 4) Mess with it!

s7dhansh commented 7 years ago

Ok. I think you meant, 2. cs ssr/demo. I am checking out the demo. It shoots error when I open it in browser:

ERROR: Cannot read property 'getCSS' of undefined
cbilotta commented 7 years ago

Yes, wrong version of styled-components. Install "styled-components": "^2.0.0-14" :)

s7dhansh commented 7 years ago

Ok Thanks. I got it working, but I could not find the right demo? Are you talking about AsyncData? Basically, I need to do a Collection.find based on certain id and use it as the data context for a component.

cbilotta commented 7 years ago

https://ssrwpo.github.io/ssr/

You need to dispatch stuff to redux store on tree walking, basically :)

s7dhansh commented 7 years ago

Ok thank you. I will check the doc and the AsyncData file and try to replicate.

PEM-- commented 7 years ago

Hey guys, if you don't mind, questions should be dedicated on a forum as others could be interested. I'm closing this and I've unsubscribed myself from this thread. If you want you can carry on here, though that could be cool to start discussing about that on Meteor's forum for instance 😉