How marciofelicioo/geography-quiz works
Project type and purpose
• This is a static, front-end quiz application (index.html + styles.css + script.js) delivered via GitHub Pages.
• Users see a set of flags and guess capitals; the app fetches questions/answers from a public REST API.
File structure
• Root files:
• index.html – single entry point (HTML template + placeholders for quiz UI)
• script.js – core quiz logic (data fetching, UI updates, score tracking)
• package.json, LICENSE, Map.mp4, Capitals.png – metadata and assets
• No backend code: all logic lives in the browser.
Key points from the README
• “Powered by a REST API” → there’s an external service providing country/flag/capital data.
• Built with HTML, CSS, JavaScript only.
• Deployed as a static site on GitHub Pages.
Main components
a. Client (Browser)
• UI Layer (HTML/CSS)
• Quiz Logic Module (script.js):
• API Service Sub-component – handles fetch requests
• Question Manager – selects and shuffles questions
• Score & State Manager – tracks user answers and score
• DOM Controller – renders questions, flags, feedback
b. External REST API
• Country Data Service (hosted elsewhere; e.g., restcountries.com)
• Provides JSON: { countryName, flagURL, capital }
c. Optional Hosting
• GitHub Pages (static file host)
Relationships & data flow
• Browser loads index.html + styles.css + script.js from GitHub Pages.
• Quiz Logic Module calls REST API (via fetch) to retrieve question data.
• API returns JSON → API Service → Question Manager → DOM Controller renders flag & options.
• User selects answer → Score Manager updates score → DOM Controller shows correct/incorrect → repeat.
Important architectural patterns & principles
• Single-Page Interaction: all logic client-side, asynchronous API calls
• Modular JavaScript: separate concerns (API wrapper, state management, rendering)
• REST interactions decoupled from UI rendering