Skip to content

elvijs/quiz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quiz App

A simple, static HTML-based quiz application. Questions and answers are stored in JSON files, making it easy to add new quiz topics.

Features

  • Multiple quiz topics
  • Multiple choice questions
  • Instant feedback on answers
  • Score tracking
  • Responsive design

Running the App

Development

Since this is a static web app, you can run it with any HTTP server:

# Python 3
python3 -m http.server 8000

# Python 2
python -m SimpleHTTPServer 8000

# Node.js (if you have http-server installed)
npx http-server

Then open http://localhost:8000 in your browser.

Production (Raspberry Pi)

For permanent deployment on a Raspberry Pi, use the included systemd service:

./install.sh

See DEPLOYMENT.md for detailed deployment instructions.

Adding a New Quiz

  1. Create a new JSON file in the quizzes/ directory (e.g., science.json)
  2. Add your questions following this format:
{
  "title": "Science Quiz",
  "description": "Test your scientific knowledge",
  "questions": [
    {
      "question": "What is the chemical symbol for water?",
      "options": ["H2O", "CO2", "O2", "N2"],
      "correctIndex": 0
    }
  ]
}
  1. Update quizzes/_manifest.json to include your new quiz:
{
  "quizzes": [
    {
      "id": "science",
      "title": "Science Quiz",
      "description": "Test your scientific knowledge",
      "file": "science.json"
    }
  ]
}

File Structure

/
  index.html              # Main quiz interface
  app.js                  # Quiz logic
  styles.css              # Styling
  install.sh              # Deployment script for Raspberry Pi
  quiz-app.service        # Systemd service file
  DEPLOYMENT.md           # Deployment documentation
  quizzes/
    _manifest.json        # Lists all available quizzes
    friends.json          # Friends quiz (20 questions)
    friends-hard.json     # Friends Hard Mode (50 questions)
    game-of-thrones.json  # Game of Thrones quiz (25 questions)

Quiz Data Format

  • title: Display name of the quiz
  • description: Short description shown on quiz selection
  • questions: Array of question objects
    • question: The question text
    • options: Array of possible answers
    • correctIndex: Index (0-based) of the correct answer in the options array

About

A tiny little quiz webapp

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors