Hello community!
So I have started learning meteor js and I have some problems with the structure of the project. I am trying to create a quiz app without saving answers to database, but showing them in a summary page after the completion of the quiz. I have tried to make something similar to this but I am getting some errors. This is my structure of the project:
\client
\questions
events.js
helpers.js
\templates
...
\shared
...
\common
schema.js
\lib
router.js
style.less
\bootstrap
...
\controllers
base.js
main_page.js
single_question.js
\methods
questions.js
\public
...
\server
publications.js
I have been trying to get schema from common/schema.js:
quizSchema = new SimpleSchema({
question: {
type: String,
autoform: {
type: "select-radio",
options: function() {
return [{
label: "Yes",
value: 1
}, {
label: "No",
value: 0
}];
}
}
}
});
in client/questions/helpers.js like so:
var quizForm = new AutoForm(quizSchema);
Template.newQuestion.helpers({
questionForm: function() {
return quizForm;
}
});
but I get undefined quizSchema inside the helpers.js. If I define quizSchema inside the helpers.js then I get autoForm is not a function. I have all the required packages. So my questions would be:
1. What would be the correct structure of this project to fix the problem above?
2. How could I override question schema after going to the next question? I am thinking in client/questions/events.js, but I do not know if it will override the schema.
3. What would be the best way to review quiz answers in a summary page? The data should disappear after refresh of the page.
I am still a learner of this amazing framework. Any suggestions would be appreciated.