Closed VikR0001 closed 8 years ago
Arunoda has kindly noted that some how-to's are needed. I've coded tons of jQuery. I've built a Meteor 1.2 test app that publishes and subscribes and does some cool stuff. But I've been hammering on publish/subscribe in Mantra for a week or so and gotten nowhere. I have tried adapting multiple Meteor Mantra sample apps and adding a new collection, but the references to collections refer back and forth to so many different files in Mantra that to a Mantra newbie like me it seems like incomprehensible spaghetti.
Could someone please post a step-by-step walkthrough describing how to add a new collection and display a list of its items in a component?
silly question, but are you calling /server/publications/index.js
from /server/index.js
(or main.js
, I think, is what the mantra cli tool makes) ?
For example:
import configs from './configs';
import publications from './publications';
configs();
publications();
Yea, I think Fernando's onto something here. Using the mantra-cli has
helped me avoid a lot of these gotchas that are a part of it being so
modular. That imports publications into server/main.js
for you.
On Tue, 22 Mar 2016 at 13:55 Fernando Mumbach notifications@github.com wrote:
silly question, but are you calling /server/publications/index.js from /server/index.js (or main.js, I think, is what the mantra cli tool makes) ?
For example:
import configs from './configs'; import publications from './publications';
configs(); publications();
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/kadirahq/mantra/issues/159#issuecomment-199826545
Thanks very much for directing my attention to main.js. For some reason I had commented out two key lines in that file:
import publications from './publications';
import methods from './methods';
//publications();
//methods();
I have uncommented them and I'm going to see if that gets my collection to load.
Also, thanks for telling me about mantra-cli. I'm going to have a look at it.
I've created a starter app using Meteor CLI. I don't have Subscribe working yet, but a question about that should probably be for another post. Using the CLI appears to answer the question I asked at the top of this thread. Thanks very much for telling me about mantra-cli.
I have the following code in server/publications/collectionname.js:
I have a breakpoint at "Meteor.publish('collectionname.single',..." Program execution does not halt at it. However, when I place a breakpoint at the same place in mantra-sample-blog-app-master, execution does halt.
It appears that the code in my app at "server/publications/collectionname.js" is not being called/executed.
In server/publications/index I have:
In lib/collections I have:
What needs to be done elsewhere in the code to make sure that the code in "server/publications/collectionname.js" is executed?