refactor: better separation of dependencies to crates

node stuff to html crate only
This commit is contained in:
Per Stark
2025-04-04 12:50:38 +02:00
parent 20fc43638b
commit 5bc48fb30b
160 changed files with 231 additions and 337 deletions

26
api-router/src/lib.rs Normal file
View File

@@ -0,0 +1,26 @@
use api_state::ApiState;
use axum::{
extract::{DefaultBodyLimit, FromRef},
middleware::from_fn_with_state,
routing::post,
Router,
};
use middleware_api_auth::api_auth;
use routes::ingress::ingest_data;
pub mod api_state;
pub mod error;
mod middleware_api_auth;
mod routes;
/// Router for API functionality, version 1
pub fn api_routes_v1<S>(app_state: &ApiState) -> Router<S>
where
S: Clone + Send + Sync + 'static,
ApiState: FromRef<S>,
{
Router::new()
.route("/ingress", post(ingest_data))
.layer(DefaultBodyLimit::max(1024 * 1024 * 1024))
.route_layer(from_fn_with_state(app_state.clone(), api_auth))
}