I’m a newbie and following an old (2015) tutorial from Udemy. The guy have a single todo.js file with both client and server code. He’s declaring all global stuff outside if (Meteor.isClient)
and if (Meteor.isServer)
tags. for example Todos = new Mongo.Collection('todos');
and same for Meteor.methods()
.
But i have a separate main.js file for both client and server with new project. So i’m adding same code in both files. Otherwise they wouldn’t work. What is the best way to add Meteor.methods
and other global functions without repeating the code?