API Gateway pour la plateforme TerraProxi. Point d'entrée unique pour tous les services.
┌─────────────────────────────────────┐
│ gateway.terraproxi.fr │
│ (Port 3000) │
└──────────────┬──────────────────────┘
│
┌────────────────────┼────────────────────┐
│ │ │
▼ ▼ ▼
┌────────────────┐ ┌────────────────┐ ┌────────────────┐
│ /auth/* │ │ /api/* │ │ /health │
│ Auth API │ │ Backend API │ │ Status │
│ (Port 3001) │ │ (Port 3002) │ │ │
└────────────────┘ └────────────────┘ └────────────────┘
bun install
cp env.example .env
bun run dev| Route | Service | Description |
|---|---|---|
/auth/* |
Auth API | Authentification, profils, tokens |
/api/* |
Backend API | API principale TerraProxi |
/health |
Gateway | État de tous les services |
/ |
Gateway | Infos et liste des services |
| Variable | Description | Défaut |
|---|---|---|
PORT |
Port de la gateway | 3000 |
AUTH_SERVICE_URL |
URL du service Auth | http://localhost:3001 |
API_SERVICE_URL |
URL du service Backend | http://localhost:3002 |
CORS_ORIGIN |
Origines CORS autorisées | localhost:3000,5173 |
# Login
curl -X POST http://localhost:3000/auth/login \
-H "Content-Type: application/json" \
-d '{"email": "user@test.com", "password": "User123!"}'
# Profil
curl http://localhost:3000/auth/profile \
-H "Authorization: Bearer YOUR_TOKEN"curl http://localhost:3000/healthRéponse :
{
"gateway": "healthy",
"timestamp": "2024-01-01T00:00:00.000Z",
"services": {
"auth": { "name": "Auth API", "healthy": true, "latency": 5 },
"api": { "name": "Backend API", "healthy": true, "latency": 8 }
},
"status": "all_services_up"
}MIT - TerraProxi Team