INNER CODE UNIT · Rust
index_playground
rkudryashov/graphql-rust-demo · auth-service/src/lib.rs:41
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, Mutation, EmptySubscription> {
Schema::build(Query, Mutation, EmptySubscription)
.enable_federation()
.data(pool)
.finish()
}
pub fn run_migrations(conn: &mut PooledConnection<ConnectionManager<PgConnection>>) {
conn.run_pending_migrations(MIGRATIONS)
.expect("Failed to run database migrations");
// if environment variable is set (in case of production environment), then update users' hash