I have developed a quiz web application that is currently only accessible locally on my machine. The logic and architecture of the app are all set up, but I am facing a challenge: how can I have the question list pulled from "questionOptions.js" externally on the production version? This way, I can easily update or modify the questions without having to export a new build version each time.
Currently, in development mode, the question list is sourced locally, and I am unsure how to make it dynamic for the final build to allow for easy editing of the questions.
Utilizing Vue.js
var looper = new Vue({
el: "#quiz",
data: {
questionList: require("./js/questionsOptions"),
currentQuestion: 0,
...
}
});
questionOptions.js
module.exports = [
{
title: "Question 1",
questionTitle: 'This is statement for Question 1',
correctAnswer: true,
answerSelection: [
{
name: "Answer 1 A",
score: true
},
{
name: "Answer 1 B",
score: false
},
]
},
{
title: "Question 2",
questionTitle: 'This is statement for Question 2',
correctAnswer: true,
answerSelection: [
{
name: "Answer 2 A",
score: true
},
{
name: "Answer 2 B",
score: false
}
]
}
]
In the future, I anticipate needing to adjust the content or length of the question list within the final build. How can I accomplish this goal?