Initial commit

This commit is contained in:
Aleksandr 2025-09-19 18:31:17 +03:00
commit bd9b07052b
81 changed files with 5516 additions and 0 deletions

35
http/src/server/mod.rs Normal file
View file

@ -0,0 +1,35 @@
use eva::perfect_derive;
use viendesu_core::{
errors::AuxResult,
service::{Service, SessionMaker, SessionOf},
};
pub mod config;
mod context;
mod handler;
mod request;
mod response;
mod routes;
pub trait Types: Send + Sync + 'static {
type Service: Service + Clone;
}
pub fn make_router<T: Types>(service: T::Service) -> axum::Router {
let scope = handler::RouterScope::root(State::<T> { service });
routes::make(scope).into_axum()
}
#[perfect_derive(Clone)]
struct State<T: Types> {
service: T::Service,
}
impl<T: Types> State<T> {
async fn make_session(&self) -> AuxResult<SessionOf<T::Service>> {
self.service.make_session().await
}
}