quiz-game

logo

Quiz Game

Welcome to the Quiz Game App!

This is .NET and Angular project designed to demonstrate a complete fullstack application with complex data relationships.

It allows users to play trivia based quiz games and record their scores. They can create, update and delete quizzes, and also visualise their previous games scores.

The web front end is delivered by Angular and utilise Angular Material components. The API back end is delivered by .NET and provides the endpoints to manage the database records.

Features

Technologies

Getting Started

[!NOTE] The InitialCreate database migration has been created.

On start-up of the API application, any required database creation/migrations will be performed programmatically.

Prerequisites

Installation

  1. Clone the repository:

    • git clone https://github.com/chrisjamiecarter/quiz-game.git
  2. Navigate to the API project directory:

    • cd src\QuizGame.Api
  3. Configure the application:

    • Update the connection string in appsettings.json.
    • You can also use .NET user secrets. Just add a value for the following keys:
      • <database-server>
      • <database-user>
      • <database-user-password>
  4. Build the application using the .NET CLI:

    • dotnet build
  5. Navigate to the Web project directory:

    • cd src\QuizGame.Web
  6. Install dependencies:

    • npm install

Running the Application

  1. You can run both applications from Visual Studio, using the Multiple Startup Projects option and selecting the *.Api and *.web projects.

OR

  1. Run the API application using the .NET CLI in the API project directory:

    • cd src\QuizGame.Api
    • dotnet run
  2. Start the development server in the Web project directory:

    • cd src\QuizGame.web
    • npm start

Usage

YouTube Video Demonstration:

Quiz Game YouTube Video

How It Works

API Endpoints

The Quiz Game API provides a set of versioned endpoints for managing quizzes, questions, answers, and games.

It uses ASP.Versioning to support API versioning, the current version is v1 and the version is specified in the URL path, e.g., /api/v1.

It uses OpenAPI for documentation, use the /swagger endpoint to view the API documentation in your browser. All responses follow RESTful standards with appropriate status codes.

Some endpoints require request validation. Example validation objects:

Endpoints

Answers

/api/v1/quizgame/answers

Method Endpoint Description
GET / Get all answers.
GET /{id} Get an answer by ID.
POST / Create a new answer.
PUT /{id} Update an existing answer.
DELETE /{id} Delete an existing answer.

Games

/api/v1/quizgame/games

Method Endpoint Description
GET / Get all games.
GET /page Get a paginated list of games.
GET /{id} Get a game by ID.
POST / Create a new game.

Questions

/api/v1/quizgame/questions

Method Endpoint Description
GET / Get all questions.
GET /{id} Get a question by ID.
GET /{id}/answers Get all answers for a specific question.
POST / Create a new question.
PUT /{id} Update an existing question.
DELETE /{id} Delete an existing question.

Quizzes

/api/v1/quizgame/quizzes

Method Endpoint Description
GET / Get all quizzes.
GET /{id} Get a quiz by ID.
GET /{id}/games Get all games for a specific quiz.
GET /{id}/questions Get all questions for a specific quiz.
POST / Create a new quiz.
PUT /{id} Update an existing quiz.
DELETE /{id} Delete an existing quiz.
DELETE /{id}/questions Delete all questions for a specific quiz.

Database

entity relationship diagram

Version

This document applies to the QuizGame v1.0.0 release version.

Contributing

Contributions are welcome! Please fork the repository and create a pull request with your changes. For major changes, please open an issue first to discuss what you would like to change.

License

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

Contact

For any questions or feedback, please open an issue.


Happy Quiz Gaming!