fazeel007 commited on
Commit
951fb3f
Β·
1 Parent(s): dd22d79

Fix Space issues: Remove blocking route and fix health check

Browse files

1. Remove emergency route that was blocking React app from loading
2. Fix health check to tolerate missing API keys (missing_key \!= error)
- Now returns 200 unless there's a real API error
- Space will show as healthy even without all API keys configured

This should make the Space show the actual React UI and remove
the 'may have issues' warning banner.

Files changed (2) hide show
  1. server/index.ts +1 -13
  2. server/routes.ts +1 -1
server/index.ts CHANGED
@@ -42,19 +42,7 @@ if (process.env.NODE_ENV === 'production') {
42
 
43
  console.log("βœ… Express app created");
44
 
45
- // IMMEDIATE fallback route - ensures HF Spaces gets a response no matter what
46
- app.get('/', (_req, res) => {
47
- console.log("πŸ†˜ EMERGENCY: Immediate root route triggered");
48
- res.send(`
49
- <h1>πŸš€ KnowledgeBridge Emergency Response</h1>
50
- <p><strong>Status:</strong> Server started but may have issues</p>
51
- <p><strong>Time:</strong> ${new Date().toISOString()}</p>
52
- <p><strong>Environment:</strong> NODE_ENV=${process.env.NODE_ENV}</p>
53
- <p><a href="/api/health">Try Health Check</a></p>
54
- `);
55
- });
56
-
57
- console.log("βœ… Emergency root route added");
58
 
59
  // Security middleware
60
  app.use(helmet({
 
42
 
43
  console.log("βœ… Express app created");
44
 
45
+ console.log("βœ… Server setup starting");
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
  // Security middleware
48
  app.use(helmet({
server/routes.ts CHANGED
@@ -1089,7 +1089,7 @@ Provide a brief, engaging explanation (2-3 sentences) that would be pleasant to
1089
  const { checkAPIHealth } = await import('./api-health-check');
1090
  const healthStatus = await checkAPIHealth();
1091
 
1092
- const overallHealthy = healthStatus.every(status => status.status === 'healthy');
1093
 
1094
  res.status(overallHealthy ? 200 : 503).json({
1095
  overall: overallHealthy ? 'healthy' : 'issues_detected',
 
1089
  const { checkAPIHealth } = await import('./api-health-check');
1090
  const healthStatus = await checkAPIHealth();
1091
 
1092
+ const overallHealthy = healthStatus.every(status => status.status !== 'error');
1093
 
1094
  res.status(overallHealthy ? 200 : 503).json({
1095
  overall: overallHealthy ? 'healthy' : 'issues_detected',