[add]: Swagger Documentation

This commit is contained in:
VivianDee
2025-03-24 08:44:57 +01:00
parent 7a4a9a9b99
commit dad8e68c9f
72 changed files with 1679 additions and 66 deletions
+16 -4
View File
@@ -1,8 +1,10 @@
from flask import Flask
import os
from flask_swagger_ui import get_swaggerui_blueprint
from flask_cors import CORS
from app.config import Config
from app.routes import api
from app.errors import method_not_allowed, unsupported_media_type
from app.api.routes import api
from app.errors import register_error_handlers
def create_app():
""" Factory function to create a Flask app instance """
@@ -14,12 +16,22 @@ def create_app():
CORS(app)
# Swagger Doc
SWAGGER_URL = app.config.get("SWAGGER_URL")
API_URL = app.config.get("API_URL")
# Register blueprints
app.register_blueprint(api)
swagger_ui_blueprint = get_swaggerui_blueprint(SWAGGER_URL, API_URL)
app.register_blueprint(swagger_ui_blueprint, url_prefix=SWAGGER_URL)
# Error Handlers
app.register_error_handler(405, method_not_allowed)
app.register_error_handler(415, unsupported_media_type)
register_error_handlers(app)
return app