This is a simple Svelte quiz application. Given a JSON trivia document of questions & answers, you can very easily create a quiz web application.
npm install
npm run dev
http://localhost:5000
npm run build
/public
folder
(If you use Firebase, this is already setup. Just configure with your project details and run firebase deploy
.)The application relies a .js file at /src/data/trivia.js
. Inside is a structure like the following:
export const trivia = {
title: "[YOUR QUIZ TITLE GOES HERE]",
questions:
[
{
// Question Text.
q: "QUESTION 1",
// The first answer will be treated as the correct answer. They will be displayed randomly, however.
// For true/false, use booleans. ie. ([true, false])
// For all other answer types, use strings
a: ["ANSWER1", "ANSWER2", "ANSWER3"],
// This will display underneath the answer on the results page. Useful for extra information, fun facts, or clarifications
followup: "FOLLOW UP TEXT"
},
...
]
}
There is no max length for the trivia. A sample trivia data has been included.