Welcome to the Node.js Trivia Game! This simple trivia game is built using Node.js, allowing you to test your knowledge on various topics while exploring the capabilities of Node.js. This is a side project to help develop a better understanding of JavaScript, Node.js, Networking, and the many other technologies behind creating a web application.
- Local Questions or Trivia API option
- Private Game Lobbies
- Global High Score
- Join Ongoing Games
- More to be added
Follow these steps to get the trivia game up and running on your local machine:
-
Clone the repository:
git clone https://github.com/ShubeeOro/Online-Trivia-Game.git cd nodejs-trivia-game
-
Install dependencies:
npm install
-
Start the game:
npm start
The trivia game will start running on
http://localhost:3000
. Open this URL in your browser to begin playing.You can also use Visual Studio Code's Local Port Forwarding via Microsoft dev tunnels to open the game on the Internet. Open port 3000 and ensure you set Port Visibility to Public. Share the created link to play with friends!
- Answer the questions presented on the screen by selecting the correct option.
- After completing a set of questions, your total score will be displayed.
- Challenge yourself to beat your high score in subsequent rounds.
Feel free to customize the trivia questions to suit your preferences. You can find the questions in the questions.json
file. Update the file with your own set of questions and answers. We use Trivia API by Open Trivia Database as the main way to get questions and fall back to questions.json
.
[
{
"category": "General Knowledge",
"difficulty": "easy",
"question": "Area 51 is located in which US state?",
"correct_answer": "Nevada",
"incorrect_answers": [
"Arizona",
"New Mexico",
"Utah"
]
},
// Add more questions as needed
]
- Node.js: The runtime environment for running the trivia game.
- Express: A web application framework for Node.js, used to handle routing.
- Socket.IO: An event-driven library for bi-directional communication between web clients and servers.
If you have ideas for improvement or new features, feel free to open an issue or submit a pull request. Contributions are welcome!
This trivia game is licensed under the MIT License. Feel free to use, modify, and distribute it as you see fit.
Enjoy playing the Node.js Trivia Game! 🎉