Spaces:
Paused
Paused
fix: handle /api probe route and fix error handler path check
Browse files
app.py
CHANGED
|
@@ -19,6 +19,7 @@ app.register_blueprint(analyze_bp, url_prefix='/api')
|
|
| 19 |
app.register_blueprint(comment_bp, url_prefix='/api')
|
| 20 |
|
| 21 |
@app.route('/')
|
|
|
|
| 22 |
def index():
|
| 23 |
return {'status': 'ok', 'service': 'CheckScan API', 'docs': '/api/health'}
|
| 24 |
|
|
@@ -30,13 +31,13 @@ def health():
|
|
| 30 |
@app.errorhandler(Exception)
|
| 31 |
def handle_any_error(err):
|
| 32 |
"""Convierte cualquier excepci贸n en JSON limpio para /api/*."""
|
| 33 |
-
if request.path.startswith('/api
|
| 34 |
-
traceback.print_exc()
|
| 35 |
return jsonify({
|
| 36 |
'error': str(err) or err.__class__.__name__,
|
| 37 |
'type': err.__class__.__name__,
|
| 38 |
}), 500
|
| 39 |
-
raise err
|
| 40 |
|
| 41 |
|
| 42 |
if __name__ == '__main__':
|
|
|
|
| 19 |
app.register_blueprint(comment_bp, url_prefix='/api')
|
| 20 |
|
| 21 |
@app.route('/')
|
| 22 |
+
@app.route('/api')
|
| 23 |
def index():
|
| 24 |
return {'status': 'ok', 'service': 'CheckScan API', 'docs': '/api/health'}
|
| 25 |
|
|
|
|
| 31 |
@app.errorhandler(Exception)
|
| 32 |
def handle_any_error(err):
|
| 33 |
"""Convierte cualquier excepci贸n en JSON limpio para /api/*."""
|
| 34 |
+
if request.path.startswith('/api'):
|
| 35 |
+
traceback.print_exc()
|
| 36 |
return jsonify({
|
| 37 |
'error': str(err) or err.__class__.__name__,
|
| 38 |
'type': err.__class__.__name__,
|
| 39 |
}), 500
|
| 40 |
+
raise err
|
| 41 |
|
| 42 |
|
| 43 |
if __name__ == '__main__':
|