use sqlx::SqlitePool; use warp::{ Filter, }; use crate::graphql::{ Context, schema, }; pub async fn web(db: SqlitePool){ std::env::set_var("RUST_LOG", "warp_async"); let state = warp::any().map(move || Context { db: db.clone() }); let graphql_filter = juniper_warp::make_graphql_filter(schema(), state.boxed()); warp::serve( warp::get() .and(warp::path("graphiql")) .and(juniper_warp::graphiql_filter("/graphql", None)) .or(warp::path("graphql").and(graphql_filter)), ) .run(([127, 0, 0, 1], 8080)) .await; }