Application Structure Meteor 1.6+

api/
lists/ # a unit of domain logic
server/
publications.js # all list-related publications
publications.tests.js # tests for the list publications
lists.js # definition of the Lists collection
lists.tests.js # tests for the behavior of that collection
methods.js # methods related to lists
methods.tests.js # tests for those methods

In the above example the methods are accessible on both the server and the client, except the ones within isServer blocks.

Can I place some methods inside the server directory, to avoid the isServer blocks?

Thanks!

Yes, you can put server only methods in imports/api/lists/server/methods.js and these methods will only be available on the server. See Building multiple apps from the same source
Also, put your publications in imports/api/lists/server/publications.js as they are server side only as well.

2 Likes

Actually, this is not true. The build process will not import code into the client from a server/ folder (or an imports/.../server/ folder), or any child folder under that, and vice versa.

damn, you’re right. Sorry for that misinformation. I was always thinking that it’s only true for folders outside the /import where it’s magically bundled.