|
|
""" |
|
|
Defines Flask routes for handling call by category |
|
|
|
|
|
This module contains API endpoints for managing and retrieving categories |
|
|
from the MongoDB database. |
|
|
|
|
|
Routes: |
|
|
- GET /category: Fetch all categories. |
|
|
""" |
|
|
from flask import jsonify |
|
|
from ..controllers.category import get_categories |
|
|
from . import category_bp |
|
|
|
|
|
@category_bp.route("/category", methods=["GET"]) |
|
|
def fetch_categories(): |
|
|
""" |
|
|
Handles GET requests to retrieve all categories. |
|
|
|
|
|
Returns: |
|
|
list[dict]: JSON response containing categories and their associated sites. |
|
|
|
|
|
Endpoint: |
|
|
GET /category |
|
|
|
|
|
""" |
|
|
category_data = get_categories() |
|
|
return jsonify(category_data), 200 |
|
|
|