Flags Server Overview

This server is designed to manage groups, flags, and quotes, providing endpoints for retrieving flags based on difficulty levels and accessing group data. The server connects to a Firestore database and also serves an HTML visualization page.

Endpoints Documentation

1. POST /get_flag

This endpoint is used to retrieve a random flag and quote based on the group information and difficulty level. The valid difficulty levels are 'easy', 'medium', or 'hard'.

        Input:
        {
            "group_number": "1",
            "group_name": "groupA",
            "difficulty_level": "easy"
        }

        Output:
        {
            "country": "France",
            "quote": "A random quote here."
        }
        

2. GET /group_data

This endpoint is used to fetch all the group data, including group names, number of requests, and flags received.

        Output:
        {
            "groups": [
                {
                    "name": "groupA",
                    "requests": 3,
                    "flags_received": ["France", "Germany", "Italy"]
                },
                // ... more groups
            ]
        }
        

Main Functionality

The server manages the selection of flags based on difficulty levels, keeping track of the flags received by different groups. It also serves an HTML file to visualize the group requests and flags received. The server reads quotes from a text file and associates them with the flags in the response.

HTML File Overview

The server hosts two HTML files. The documentation.html is the API documentation that you're currently viewing, served at the root URL. The status.html is the group visualization page, served at /status.html. It provides a table view of the group names, number of requests, and flags received.

Concluding Remarks

As always, if you have any suggestions to improve the documentation here, please reach out to me on Discord.