node.js - Meteor file system -
i have question meteor file structure. i´m coming java maybe i'm thinking way complicated.
when create new meteor project (using osx shell), creates folder /usr/myusername/projectname/
.
inside you'll find the: project.js
, project.html
, project.css
, .meteor
folder.
what want is:
create structure like: /usr/myusername/projectname/
there want create server client folder. put client.js
, server.js
into.
where set references? example following code in project/client/client.js
:
meteor.call('somefunc', someobj);
i have in project/server/server.js
following code:
if (meteor.isserver) { meteor.startup(function () { meteor.methods({ 'somefunc':function(someobj){ calevent.insert(someobj); } }) }); }
where in client.js tell server.js is? , how?
long story short : don't have worry references, long put things belong in client under client/
, server-side stuff under server/
you're go.
no need wrap code meteor.isserver
blocks if lives under server/
. don't need meteor.startup
block either, code put in these sections rerun everytime server restarted need method defined once.
the meteor
tool build process takes care of merging client files , sends them browser execution, likewise it's merging server files , spawn node.js process execute resulting bundle.
Comments
Post a Comment