I'm trying to understand Meteor as I create a project and I find some things a little difficult to understand so far.
1- When they say I can create a server
and a client
folder, where exactly I am meant to do so? Sibling of .meteor
? And will everything be at client's or server's scope when the app starts or do I have to do something else? If I create a foo.js
and a foo
function inside it in client
folder, can I just call foo()
in Meteor.isClient
and it will work?
2- I need to create an upload folder so people can upload their stuff (images). So where am I supposed to do this? Plus, how can I get the absolute path to my project and find this upload
folder inside?
During my attempts I tried the following:
fs = Meteor.npmRequire('fs');
__ROOT_APP_PATH__ = fs.realpathSync('.');
But __ROOT_APP_PATH__
is .meteor\local\build\programs\server
. Quite hidden right?!
3- I saw some people uploading and saving files on MongoDB directly. This is something we usually don't do with relational databases. We move the file to a known folder on a CDN or on our own disk and save the hash or name of that file so we can easily find it. Isn't it encouraged with Meteor + MongoDB? Why would I save the file itself on Mongo instead of moving it to a folder?