mirror of
https://github.com/Anrab35/SAE410_TP2.git
synced 2024-10-21 21:26:09 +02:00
25 lines
No EOL
803 B
Python
25 lines
No EOL
803 B
Python
from flask import Flask, send_file
|
|
from flask_swagger_ui import get_swaggerui_blueprint
|
|
|
|
app = Flask(__name__)
|
|
|
|
SWAGGER_URL = '/docs' # URL for exposing Swagger UI (without trailing '/')
|
|
API_URL = '/docs/api/swagger.yml' # Our API url (can of course be a local resource)
|
|
|
|
@app.route(API_URL, methods=['GET'])
|
|
def swagger_yml():
|
|
# Read before use: http://flask.pocoo.org/docs/0.12/api/#flask.send_file
|
|
return send_file('/app/swagger.yml')
|
|
|
|
# Call factory function to create our blueprint
|
|
swaggerui_blueprint = get_swaggerui_blueprint(
|
|
SWAGGER_URL, # Swagger UI static files will be mapped to '{SWAGGER_URL}/dist/'
|
|
API_URL,
|
|
config={ # Swagger UI config overrides
|
|
'app_name': "JO"
|
|
},
|
|
)
|
|
|
|
app.register_blueprint(swaggerui_blueprint)
|
|
|
|
app.run(host="0.0.0.0", debug=False) |