I want to build a modularized meteor app, as for me it is the easiest way to develop separated modules. I think the new import
folder should be used for that. So I would start with this structure for an article-module - like it is explained in the guide (if I understand that correctly):
imports/
api/
articles/
publication.js
methods.js
collection.js
ui/
articles/
article.html
article.css
article.js // contains helpers, events and onCreated/onRendered
startup/
client/
server/
So I would import the needed files in the startup folder:
startup/server/index.js
import '../../api/articles/collection.js';
import '../../api/articles/publications.js';
import '../../api/articles/methods.js';
startup/client/index.js
import '../../api/articles/collection.js';
import '../../api/articles/methods.js';
import '../../ui/articles/article.html';
import '../../ui/articles/article.css';
import '../../ui/articles/article.js';
In the app I would import the startup files in the client/server folder and everything is working fine. Great!
But:
- Is there any improvements/advices to that struture?
- I don’t understand the advantage in this style vs. just put the files in the root server and client folder!!
- Is it tecnically possible to load modules only if user has some defined roles? So if a user is no editor, I don’t need this module to be loaded. So this would make sence for me to use imports…