If you want to save the server-side code on the server, you will have to restructure the application.
Make these directories in the root directory of your application:
- / server - saves everything to run only on the server
- / client - saves everything that is needed to run only on the client
- / public / - stores everything that should be available in the format
http://yoursite/ (for example, images, fonts). If you put the a.jpg image in /public , it will be available at http://yoursite/a.jpg
After using this structure, you no longer need to use the conditions if(Meteor.isServer) {..} or if(Meteor.isClient) {..} , since they will work in the right place.
When you put files in the root directory of your meteor application, they will be launched both on the client and on the server, which is why this is why the file does not change and everything in if(Meteor.isServer) will only work on the server.
This is by design and very useful to use the code between the server and the client, although it will be visible to both the client and the server
source share