fix: export app and register meal-plans routes
Some checks failed
Basil CI/CD Pipeline / Code Linting (push) Successful in 58s
Basil CI/CD Pipeline / Web Tests (push) Failing after 1m13s
Basil CI/CD Pipeline / API Tests (push) Failing after 1m18s
Basil CI/CD Pipeline / Shared Package Tests (push) Successful in 56s
Basil CI/CD Pipeline / Security Scanning (push) Successful in 1m9s
Basil CI/CD Pipeline / Build All Packages (push) Has been skipped
Basil CI/CD Pipeline / E2E Tests (push) Has been skipped
Basil CI/CD Pipeline / Build & Push Docker Images (push) Has been skipped
Basil CI/CD Pipeline / Trigger Deployment (push) Has been skipped
Some checks failed
Basil CI/CD Pipeline / Code Linting (push) Successful in 58s
Basil CI/CD Pipeline / Web Tests (push) Failing after 1m13s
Basil CI/CD Pipeline / API Tests (push) Failing after 1m18s
Basil CI/CD Pipeline / Shared Package Tests (push) Successful in 56s
Basil CI/CD Pipeline / Security Scanning (push) Successful in 1m9s
Basil CI/CD Pipeline / Build All Packages (push) Has been skipped
Basil CI/CD Pipeline / E2E Tests (push) Has been skipped
Basil CI/CD Pipeline / Build & Push Docker Images (push) Has been skipped
Basil CI/CD Pipeline / Trigger Deployment (push) Has been skipped
- Export app from index.ts for testing - Only start server when run directly (not imported) - Add meal-plans routes to Express app - Fixes "Cannot read properties of undefined" supertest error Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,7 @@ import cookbooksRoutes from './routes/cookbooks.routes';
|
||||
import tagsRoutes from './routes/tags.routes';
|
||||
import backupRoutes from './routes/backup.routes';
|
||||
import authRoutes from './routes/auth.routes';
|
||||
import mealPlansRoutes from './routes/meal-plans.routes';
|
||||
import './config/passport'; // Initialize passport strategies
|
||||
import { testEmailConfig } from './services/email.service';
|
||||
|
||||
@@ -37,16 +38,22 @@ app.use('/api/recipes', recipesRoutes);
|
||||
app.use('/api/cookbooks', cookbooksRoutes);
|
||||
app.use('/api/tags', tagsRoutes);
|
||||
app.use('/api/backup', backupRoutes);
|
||||
app.use('/api/meal-plans', mealPlansRoutes);
|
||||
|
||||
// Health check
|
||||
app.get('/health', (req, res) => {
|
||||
res.json({ status: 'ok', timestamp: new Date().toISOString() });
|
||||
});
|
||||
|
||||
// Start server
|
||||
app.listen(PORT, async () => {
|
||||
console.log(`🌿 Basil API server running on http://localhost:${PORT}`);
|
||||
// Export app for testing
|
||||
export default app;
|
||||
|
||||
// Test email configuration on startup
|
||||
await testEmailConfig();
|
||||
});
|
||||
// Start server only if this file is run directly (not imported)
|
||||
if (require.main === module) {
|
||||
app.listen(PORT, async () => {
|
||||
console.log(`🌿 Basil API server running on http://localhost:${PORT}`);
|
||||
|
||||
// Test email configuration on startup
|
||||
await testEmailConfig();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user