use axum::{
Router,
routing::{get, post},
};
use fraiseql_core::db::traits::DatabaseAdapter;
pub mod admin;
pub mod design;
#[cfg(feature = "federation")]
pub mod federation;
pub mod openapi;
pub mod query;
pub mod schema;
pub mod tenant_admin;
pub mod types;
pub use types::{ApiError, ApiResponse};
pub fn routes<A: DatabaseAdapter + Clone + Send + Sync + 'static>(
state: crate::routes::graphql::AppState<A>,
) -> Router {
#[allow(unused_mut)]
let mut router = Router::new()
.route("/query/validate", post(query::validate_handler::<A>))
.route("/query/stats", get(query::stats_handler::<A>));
#[cfg(feature = "federation")]
{
router = router
.route("/federation/subgraphs", get(federation::subgraphs_handler::<A>))
.route("/federation/graph", get(federation::graph_handler::<A>));
}
router.with_state(state)
}