vimalk78 commited on
Commit
bc400e7
·
1 Parent(s): 20d5f9d

Add debug logging for static files directory

Browse files

- Check if static files exist in production
- Log static files path and directory contents
- Help diagnose HF Spaces static file serving issue

Files changed (1) hide show
  1. crossword-app/backend/src/app.js +11 -0
crossword-app/backend/src/app.js CHANGED
@@ -63,6 +63,17 @@ app.use('/api', apiRoutes);
63
  // Serve static files in production
64
  if (process.env.NODE_ENV === 'production') {
65
  const staticPath = path.join(__dirname, '../public');
 
 
 
 
 
 
 
 
 
 
 
66
  app.use(express.static(staticPath));
67
 
68
  // Handle React Router routes - serve index.html for non-API routes
 
63
  // Serve static files in production
64
  if (process.env.NODE_ENV === 'production') {
65
  const staticPath = path.join(__dirname, '../public');
66
+ console.log(`Static files path: ${staticPath}`);
67
+
68
+ // Check if static files exist
69
+ const fs = require('fs');
70
+ try {
71
+ const files = fs.readdirSync(staticPath);
72
+ console.log(`Static files found:`, files);
73
+ } catch (error) {
74
+ console.error(`Error reading static files directory:`, error.message);
75
+ }
76
+
77
  app.use(express.static(staticPath));
78
 
79
  // Handle React Router routes - serve index.html for non-API routes