I saw a recent blog post by Sacha Greif about client/server folders, and folder structure, and it got me thinking about the lib folder. I was wondering what code it absolutely has to go into that folder, and how you determine what code should go there. (i.e. what sorts of things need to be loaded before everything else?)
I usually put my collection definitions in the lib folder so they get loaded first.
1 Like
Basically anything that needs to be loaded before the other folders. For example I put namespaces in the lib folder so when I use db.posts.find
anywhere I know that db
will be defined.
If you get yourVariable
is not defined errors than the lib
folder can help solve that issue.
1 Like