feat(backend): ayarlar, MongoDB bağlantısı, Türkçe hata yapısı ve DB'li health check
- config.rs: ortam değişkenleri ve doğrulama - db.rs: bağlantı + ping (5 sn zaman aşımı) - error.rs: AppError → Türkçe JSON hata yanıtı - /api/health: veritabanına erişilemezse 503 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
//! Tüm route'ların paylaştığı uygulama durumu.
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use mongodb::Database;
|
||||
|
||||
use crate::config::Config;
|
||||
|
||||
/// `Clone` ucuzdur: `Database` ve `Arc` içte referans sayımı kullanır, veri kopyalanmaz.
|
||||
#[derive(Clone)]
|
||||
pub struct AppState {
|
||||
pub db: Database,
|
||||
#[allow(dead_code)] // Faz 1 – Adım 3'te kullanılacak
|
||||
pub config: Arc<Config>,
|
||||
}
|
||||
Reference in New Issue
Block a user