INNER CODE UNIT · Rust
index_playground
rkudryashov/graphql-rust-demo · satellites-service/src/lib.rs:30
async fn index_playground() -> HttpResponse {
HttpResponse::Ok()
.content_type("text/html; charset=utf-8")
.body(playground_source(GraphQLPlaygroundConfig::new("/")))
}
pub fn create_schema_with_context(pool: PgPool) -> Schema<Query, EmptyMutation, EmptySubscription> {
Schema::build(Query, EmptyMutation, EmptySubscription)
.data(pool)
.finish()
}
pub fn run_migrations(conn: &mut PooledConnection<ConnectionManager<PgConnection>>) {
conn.run_pending_migrations(MIGRATIONS)
.expect("Failed to run database migrations");
}
pub fn get_conn_from_ctx(ctx: &Context<'_>) -> PooledConnection<ConnectionManager<PgConnection>> {