Add missing API routes and improve system stability for production

Add missing API routes (/api/users, /api/roles, /api/deliveries) and resolve 404 errors in production, alongside improvements to authentication and core routing.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 54292eb6-296c-47a3-8f4e-c9967863556c
Replit-Commit-Checkpoint-Type: full_checkpoint
This commit is contained in:
michaelschal committed 2025-08-11 16:13:12 +00:00
1 parent aa3b4567ac
commit b079805288
5 files changed
+199 -6

No files matched your search

+6 -5
View File
@@ -26,8 +26,9 @@ curl -u admin:admin https://logiflow.ffnancy.fr/api/deliveries
3. L'API `/api/user` doit fonctionner après connexion
## Corrections incluses
- getUserWithGroups() utilise maintenant des requêtes SQL manuelles (plus de référence à userGroups.createdAt)
- Système d'authentification robuste avec support multi-format
- Endpoint d'urgence pour reset admin si nécessaire
- Routage amélioré pour la page principale (fix 502)
- Version compilée: $(date)
- ✅ **Routes manquantes ajoutées** : /api/users, /api/roles, /api/deliveries maintenant disponibles en production
- ✅ getUserWithGroups() utilise des requêtes SQL manuelles (plus d'erreur userGroups.created_at)
- ✅ Système d'authentification robuste avec support multi-format
- ✅ Endpoint d'urgence pour reset admin si nécessaire
- ✅ Routage amélioré pour la page principale (fix 502)
- ✅ Taille bundle: 198.5kb (vs 85kb) - toutes les routes incluses
+32
View File
@@ -0,0 +1,32 @@
# DÉPLOIEMENT URGENT - LogiFlow
## Problème critique résolu
❌ **Avant** : Routes manquantes en production (/api/users, /api/deliveries, /api/roles retournaient 404)
✅ **Après** : Toutes les routes API disponibles
## Action IMMÉDIATE
```bash
# Sur votre serveur de production
cd /path/to/logiflow
docker-compose up --build -d
```
## Vérification immédiate
Après déploiement, testez ces URLs qui échouaient avant :
- https://logiflow.ffnancy.fr/api/users (ne doit plus retourner 404)
- https://logiflow.ffnancy.fr/api/deliveries (ne doit plus retourner 404)
- https://logiflow.ffnancy.fr/api/roles (ne doit plus retourner 404)
## Test automatique
```bash
node debug-deliveries-production.js https://logiflow.ffnancy.fr
```
## Résultat attendu
- ✅ Module Utilisateurs : Affiche les utilisateurs enregistrés
- ✅ Module Livraisons : Affiche les données de la base
- ✅ Module Tâches : Fonctionne normalement
- ✅ Module Commandes clients : Données visibles
- ✅ Plus d'erreurs 404 dans les logs
**TEMPS ESTIMÉ** : 2-3 minutes de déploiement
@@ -0,0 +1,156 @@
User-related
Environment-related
Registries
Logs
Notifications
Settings
New version available 2.27.9
DismissSee what's new
Community Edition
2.27.6 LTS
Containers>logiflow-logiflow-1>Logs
Container logs
admin
Log viewer settings
Auto-refresh logs
Wrap lines
Display timestamps
Fetch
All logs
Search
Filter...
Lines
100
Actions
🔗 Database initialization: {
NODE_ENV: 'production',
isProduction: true,
hasDbUrl: true,
dbHost: 'logiflow-db'
}
🐳 PRODUCTION: Using standard PostgreSQL
✅ PostgreSQL connection test successful
🐳 PRODUCTION: Using PostgreSQL storage
🐳 PRODUCTION: Local auth configured with PostgreSQL sessions
🐳 PRODUCTION: Starting LogiFlow application
🐳 Environment: { NODE_ENV: 'production', DATABASE_URL: 'Present', PORT: '3000' }
🐳 Serving static files from: /app/dist/public
🐳 PRODUCTION: LogiFlow serving on port 3000
✅ Production admin user found: { id: 'admin_local', username: 'admin', passwordFormat: 'present' }
🔐 Production password comparison { suppliedLength: 5, storedFormat: '21ff482668...' }
✅ Password matched with hash.salt format
✅ Admin password works with current system
HEAD /api/health 200 in 8ms
📄 SPA: Serving index.html for /users
GET /api/user 304 in 7ms
GET /api/user 304 in 7ms
GET /api/user 304 in 6ms
GET /api/user 304 in 9ms
GET /api/groups 304 in 15ms
GET /api/users 404 in 37ms
GET /api/roles 404 in 52ms
GET /api/users 404 in 8ms
GET /api/roles 404 in 6ms
GET /api/user 401 in 2ms
GET /api/user 401 in 2ms
GET /api/default-credentials-check 200 in 2ms
GET /api/user 304 in 8ms
GET /api/deliveries 404 in 7ms
GET /api/deliveries 404 in 5ms
GET /api/deliveries 404 in 8ms
🔐 Production password comparison { suppliedLength: 8, storedFormat: 'c81960e064...' }
❌ No password format matched
POST /api/login 400 in 5ms
GET /api/deliveries 404 in 14ms
🔐 Production password comparison { suppliedLength: 8, storedFormat: 'c81960e064...' }
❌ No password format matched
POST /api/login 400 in 4ms
🔐 Production password comparison { suppliedLength: 8, storedFormat: 'c81960e064...' }
❌ No password format matched
POST /api/login 400 in 5ms
🔐 Production password comparison { suppliedLength: 8, storedFormat: 'c81960e064...' }
❌ No password format matched
POST /api/login 400 in 6ms
🔐 Production password comparison { suppliedLength: 8, storedFormat: 'c81960e064...' }
❌ No password format matched
POST /api/login 400 in 4ms
🔐 Production password comparison { suppliedLength: 8, storedFormat: 'c81960e064...' }
❌ No password format matched
POST /api/login 400 in 4ms
🔐 Production password comparison { suppliedLength: 8, storedFormat: 'c81960e064...' }
❌ No password format matched
POST /api/login 400 in 4ms
HEAD /api/health 200 in 1ms
Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

+5 -1
View File
@@ -98,7 +98,11 @@ async function registerProductionRoutes(app: Express): Promise<Server> {
// Setup authentication
setupLocalAuth(app);
// Basic API routes for production
// Import and register all routes from routes.ts instead of having limited routes
const { registerRoutes } = await import('./routes.js');
await registerRoutes(app);
// Additional health check route for Docker compatibility
app.get('/api/groups', requireAuth, async (req: Request, res: Response) => {
try {
const groups = await storage.getGroups();