Giter VIP home page Giter VIP logo

imran-khani / mythologytriviagame Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fahdi/mythologytriviagame

0.0 0.0 0.0 63 KB

A simple web-based trivia game that challenges players with mythology-themed questions. Built with HTML, CSS, and JavaScript, this game fetches questions from the Open Trivia Database API and tracks the player's score. Perfect for anyone interested in mythology and trivia games.

License: MIT License

JavaScript 56.94% CSS 22.21% HTML 20.85%

mythologytriviagame's Introduction

Trivia Game

A simple web-based trivia game that challenges players with questions from various categories. Built with HTML, CSS, and JavaScript, this game fetches questions from the Open Trivia Database API and tracks the player's score. Perfect for anyone interested in mythology and trivia games.

Table of Contents

Features

  • Trivia questions from multiple categories and difficulties
  • Real-time score tracking
  • User leaderboard showcasing top scores
  • Responsive design for various devices

Installation

  1. Clone the repository:

    git clone https://github.com/your-username/mythology-trivia-game.git
    cd mythology-trivia-game
  2. Install the dependencies:

    cd Backend
    npm install
  3. Set up environment variables:

    Create a .env file in the Backend directory and add the following:

    MONGO_URI=your_mongodb_connection_string
    PORT=your_desired_port (optional, default is 6000)
    

Usage

  1. Start the server:

    cd Backend
    npm run dev

    The server will start on the port specified in the .env file or the default port 6000.

  2. Open the frontend:

    Open index.html in your browser to start playing the game.

API Endpoints

POST /submit-score

Submit a user's score.

  • Request:

    {
      "name": "PlayerName",
      "score": 100
    }
  • Response:

    {
      "message": "Score submitted successfully"
    }

GET /leaderboard

Retrieve the top 10 scores.

  • Response:
    [
      {
        "name": "PlayerName1",
        "score": 150
      },
      {
        "name": "PlayerName2",
        "score": 120
      },
      ...
    ]

Technologies Used

  • Frontend:

    • HTML
    • CSS
    • JavaScript
  • Backend:

    • Node.js
    • Express
    • Mongoose
    • MongoDB
  • Dependencies:

    • cors: Enables Cross-Origin Resource Sharing
    • dotenv: Loads environment variables from a .env file
    • nodemon: Automatically restarts the server on file changes (development use)

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

License

This project is licensed under the MIT License. See the LICENSE file for details.

mythologytriviagame's People

Contributors

fahdi avatar imran-khani avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.