This commit is contained in:
5t4l1n
2025-07-25 23:58:20 +05:30
parent b70e81d201
commit 4d8061616d
112 changed files with 14445 additions and 59 deletions
+43
View File
@@ -0,0 +1,43 @@
from flask import Blueprint, jsonify, current_app
import asyncio
from bson import ObjectId
bp = Blueprint('courses', __name__)
# Remove trailing slash from route definition
@bp.route("/", methods=["GET"])
@bp.route("", methods=["GET"]) # Add this line to handle both cases
def list_courses():
try:
# Your existing course logic here
# Mock data for now since you're having DB async issues
courses = [
{
"id": "python-course",
"title": "Python Programming Mastery",
"subject": "Programming",
"description": "Learn Python from basics to advanced concepts",
"difficulty": "Beginner to Advanced",
"progress": 0
},
{
"id": "java-course",
"title": "Java Development Bootcamp",
"subject": "Programming",
"description": "Master Java programming with object-oriented concepts",
"difficulty": "Intermediate",
"progress": 0
},
{
"id": "ethical-hacking-course",
"title": "Ethical Hacking & Cybersecurity",
"subject": "Cybersecurity",
"description": "Learn ethical hacking techniques and penetration testing",
"difficulty": "Advanced",
"progress": 0
}
]
return jsonify(courses)
except Exception as e:
print(f"Error in list_courses: {e}")
return jsonify({"error": "Failed to fetch courses"}), 500