Spaces:
Paused
Paused
Mr-Haseeb786 commited on
Commit ·
5b0bd16
1
Parent(s): 7c90eef
fixes
Browse files- app_new.py +24 -4
app_new.py
CHANGED
|
@@ -271,10 +271,19 @@ def react_app(path=''):
|
|
| 271 |
# Fallback to template if React build doesn't exist
|
| 272 |
return render_template('index.html')
|
| 273 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 274 |
@app.route('/')
|
| 275 |
def index():
|
| 276 |
-
"""
|
| 277 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
| 278 |
|
| 279 |
# ==================== REST API Endpoints for React ====================
|
| 280 |
|
|
@@ -1134,16 +1143,27 @@ def upload_cv():
|
|
| 1134 |
|
| 1135 |
return render_template('upload_cv.html')
|
| 1136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1137 |
@app.errorhandler(404)
|
| 1138 |
def not_found(error):
|
| 1139 |
"""Handle 404 errors"""
|
| 1140 |
-
return
|
| 1141 |
|
| 1142 |
@app.errorhandler(500)
|
| 1143 |
def internal_error(error):
|
| 1144 |
"""Handle 500 errors"""
|
| 1145 |
logger.error(f"Internal server error: {str(error)}")
|
| 1146 |
-
return
|
| 1147 |
|
| 1148 |
if __name__ == '__main__':
|
| 1149 |
port = int(os.environ.get('PORT', 5050))
|
|
|
|
| 271 |
# Fallback to template if React build doesn't exist
|
| 272 |
return render_template('index.html')
|
| 273 |
|
| 274 |
+
# @app.route('/')
|
| 275 |
+
# def index():
|
| 276 |
+
# """Render the home page."""
|
| 277 |
+
# return render_template('index.html')
|
| 278 |
+
|
| 279 |
@app.route('/')
|
| 280 |
def index():
|
| 281 |
+
"""Root health check for Hugging Face."""
|
| 282 |
+
return jsonify({
|
| 283 |
+
'status': 'online',
|
| 284 |
+
'service': 'Job Apply AI API',
|
| 285 |
+
'message': 'Backend is running! Connect via Vercel frontend.'
|
| 286 |
+
}), 200
|
| 287 |
|
| 288 |
# ==================== REST API Endpoints for React ====================
|
| 289 |
|
|
|
|
| 1143 |
|
| 1144 |
return render_template('upload_cv.html')
|
| 1145 |
|
| 1146 |
+
# @app.errorhandler(404)
|
| 1147 |
+
# def not_found(error):
|
| 1148 |
+
# """Handle 404 errors"""
|
| 1149 |
+
# return render_template('404.html'), 404
|
| 1150 |
+
|
| 1151 |
+
# @app.errorhandler(500)
|
| 1152 |
+
# def internal_error(error):
|
| 1153 |
+
# """Handle 500 errors"""
|
| 1154 |
+
# logger.error(f"Internal server error: {str(error)}")
|
| 1155 |
+
# return render_template('500.html'), 500
|
| 1156 |
+
|
| 1157 |
@app.errorhandler(404)
|
| 1158 |
def not_found(error):
|
| 1159 |
"""Handle 404 errors"""
|
| 1160 |
+
return jsonify({'success': False, 'error': 'API endpoint not found'}), 404
|
| 1161 |
|
| 1162 |
@app.errorhandler(500)
|
| 1163 |
def internal_error(error):
|
| 1164 |
"""Handle 500 errors"""
|
| 1165 |
logger.error(f"Internal server error: {str(error)}")
|
| 1166 |
+
return jsonify({'success': False, 'error': 'Internal server error occurred'}), 500
|
| 1167 |
|
| 1168 |
if __name__ == '__main__':
|
| 1169 |
port = int(os.environ.get('PORT', 5050))
|