mantrajs / mantra-sample-blog-app

A sample blog app built with Mantra

Home Page: http://mantra-sample-blog-app.herokuapp.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Single module app. Index.js for method_stubs/ and actions/

t35h opened this issue · comments

commented

I'm starting off focusing on a single module with users and posts features. Is this the correct approach for these files? I'm new to meteor and mantra. Pardon my ignorance.

// client/modules/core/configs/method_stubs/index.js

import users from './users';
import posts from './posts';

export default function (context) {
  users(context);
  posts(context);
}
// client/modules/core/actions/index.js

import users from './users';
import posts from './posts';

export default {
  users,
  posts
};

Yeah. This should be the way.

Seems correct, as long as you think that this part of functionality belongs to "core" module.
Maybe we can decouple these posts and comments from demo app also and show how to do collections init in posts/comments modules.
So they would be really ready to be bundled as separate npm modules for the future.
Maybe even abstract routes to separate package - as currently in demo it is just routes.jsx, but not in separate directory. That means if they grow and need to be spread to more files, it can look bad in the module root directory.
Or spread routes to posts/comments module directories so we can see that injectDeps can be used also in these separate modules to do it's job.
If we want to set example for larger apps too.