eface2face / meteor-client

Meteor client libraries
MIT License
23 stars 2 forks source link

Example project? #2

Open GeoffreyBooth opened 9 years ago

GeoffreyBooth commented 9 years ago

Would you mind please posting an example project that shows how to use this with browserify? How would I connect a server-side database, accessed via Ajax say, with a Meteor collection or minimongo?

wzalazar commented 9 years ago

Great job, can you create one example how to use de project? thank you!

afaur commented 9 years ago

@GeoffreyBooth and @wzalazar

The minimongo functionality can be located in https://github.com/eface2face/meteor-observe-sequence/blob/master/observe_sequence.js#L11

You could connect to a rest/json endpoint and then write the data into the LocalCollection that you instantiate in your own client code. This should allow you to read and write client side data.

If you don't need the ability to query the data in a mongoish way on client you could probably just create a ReactiveVar with an object and inject it into template. Anytime you update it in javascript it would force any templates that you used it in to recompile and re-render.

If you are trying to use a meteor collection server-side to populate and sync the LocalCollection then you might have trouble. This project from my understanding currently does not include any of the pub/sub DDP client code.

Some of that logic might be in the meteor source around here: https://github.com/meteor/meteor/blob/devel/packages/ddp-client/livedata_connection.js#L1357 The documentation says that particular method is faking it, but basically DDP over websockets seems to be responsible for this.

Hopefully that helps a little, I think an example would be good. If that's something your still interested in seeing without the DDP portion then let me know and I will try to work on an example.

emmanuelbuah commented 8 years ago

I'd also like to know how to use browserify to include this library clientside.

ibc commented 8 years ago

Just read the browserify doc.

emmanuelbuah commented 8 years ago

No worries. I figured it out. Pretty easy. @ibc any idea how to compile blaze templates client-side using meteor-client?

afaur commented 8 years ago

@emmanuelbuah Use this https://github.com/eface2face/spacebars-compiler see spacebars / blaze for more info.