Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meteor methods in lib folder #196

Open
PolGuixe opened this issue Jun 21, 2016 · 1 comment
Open

Meteor methods in lib folder #196

PolGuixe opened this issue Jun 21, 2016 · 1 comment

Comments

@PolGuixe
Copy link

In the current mantra spec, it is recommended to define the methods in the server and then again to define a method stub in the client to benefit from the optimistic UI. But this results in a lot of code replication.

Wouldn't be better to define the methods in lib or common code as it is suggested by the guide?

@macrozone
Copy link

I put my methods in the lib folder for the same reason, but most of them are know wrapped in a if(Meteor.isServer), because only simple inserts or update-methods work properly on the client.

If your method needs additional data from other collections, it can get error-prone on the client, because you might not have subscribed to the additional data.

But with mdg:validated-methods, you want to share at least the validate-function, so I am thinking about writing a mixin for mdg:validated-methods that introduces a runClient and runServer-method, so that you can separate them more easily, while still having both in the same place (in /libs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants