I created test Meteor application and I found that overall code (server-side too) available to look with dev tools on a client. Test app (In browser):
(function(){ if (Meteor.isClient) {
Template.hello.greeting = function () {
return "Welcome to test_app.";
};
Template.helo.events({
'click input' : function () {
// template data, if any, is available in 'this'
if (typeof console !== 'undefined')
console.log("You pressed the button");
}
});
}
if (Meteor.isServer) {
Meteor.startup(function () {
// code to run on server at startup
});
}
}).call(this);
Is this by design? Can server-side code stay at server?
It is a Full Stack Framework The developers can take advantage of the features provided by Meteor. js to create both the backend and frontend user interface of the application rapidly.
Client-side scripting simply means running scripts, such as JavaScript, on the client device, usually within a browser. All kinds of scripts can run on the client side if they are written in JavaScript, because JavaScript is universally supported.
If you want to keep server side code on the server you have to restructure your app.
Make these directories in the root directory of your application:
http://yoursite/
(i.e images, fonts). If you place an image a.jpg
in /public
it will be available at http://yoursite/a.jpg
Once you use this structure you don't have to use the if(Meteor.isServer) {..}
or if(Meteor.isClient) {..}
conditions anymore as they would run in the right place.
When you put files in the root directory of your meteor application, they would run on both the client and the server so this is why the file is unaltered & everything in the if(Meteor.isServer)
would only run on the server.
It is by design and quite helpful to share code between the server and client, though it would be visible to both the client & server
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With