mirror of
https://github.com/perstarkse/minne.git
synced 2026-04-01 07:03:10 +02:00
refactor: better separation of dependencies to crates
node stuff to html crate only
This commit is contained in:
26
api-router/src/lib.rs
Normal file
26
api-router/src/lib.rs
Normal 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))
|
||||
}
|
||||
Reference in New Issue
Block a user