Upgrade rocket crate to 0.5.0-rc.2 version

This commit is contained in:
tyranron 2022-05-11 20:54:17 +03:00
parent 6b3898b077
commit 1f0f683d0b
No known key found for this signature in database
GPG key ID: 762E144FB230A4F0
4 changed files with 10 additions and 8 deletions

View file

@ -11,6 +11,7 @@ All user visible changes to `juniper_rocket` crate will be documented in this fi
### BC Breaks ### BC Breaks
- Switched to 0.16 version of [`juniper` crate]. - Switched to 0.16 version of [`juniper` crate].
- Switched to 0.5.0-rc.2 version of [`rocket` crate].
### Added ### Added
@ -30,4 +31,5 @@ See [old CHANGELOG](/../../blob/juniper_rocket-v0.8.1/juniper_rocket/CHANGELOG.m
[`juniper` crate]: https://docs.rs/juniper [`juniper` crate]: https://docs.rs/juniper
[`rocket` crate]: https://docs.rs/rocket
[Semantic Versioning 2.0.0]: https://semver.org [Semantic Versioning 2.0.0]: https://semver.org

View file

@ -19,7 +19,7 @@ exclude = ["/examples/", "/tests/", "/release.toml"]
[dependencies] [dependencies]
futures = "0.3.1" futures = "0.3.1"
juniper = { version = "0.16.0-dev", path = "../juniper", default-features = false } juniper = { version = "0.16.0-dev", path = "../juniper", default-features = false }
rocket = { version = "0.5.0-rc.1", default-features = false } rocket = { version = "0.5.0-rc.2", default-features = false }
serde_json = "1.0.2" serde_json = "1.0.2"
[dev-dependencies] [dev-dependencies]

View file

@ -2,12 +2,12 @@ use juniper::{
tests::fixtures::starwars::schema::{Database, Query}, tests::fixtures::starwars::schema::{Database, Query},
EmptyMutation, EmptySubscription, RootNode, EmptyMutation, EmptySubscription, RootNode,
}; };
use rocket::{response::content, Rocket, State}; use rocket::{response::content, State};
type Schema = RootNode<'static, Query, EmptyMutation<Database>, EmptySubscription<Database>>; type Schema = RootNode<'static, Query, EmptyMutation<Database>, EmptySubscription<Database>>;
#[rocket::get("/")] #[rocket::get("/")]
fn graphiql() -> content::Html<String> { fn graphiql() -> content::RawHtml<String> {
juniper_rocket::graphiql_source("/graphql", None) juniper_rocket::graphiql_source("/graphql", None)
} }
@ -31,7 +31,7 @@ fn post_graphql_handler(
#[rocket::main] #[rocket::main]
async fn main() { async fn main() {
Rocket::build() let _ = rocket::build()
.manage(Database::new()) .manage(Database::new())
.manage(Schema::new( .manage(Schema::new(
Query, Query,

View file

@ -46,8 +46,8 @@ pub struct GraphQLResponse(pub Status, pub String);
pub fn graphiql_source( pub fn graphiql_source(
graphql_endpoint_url: &str, graphql_endpoint_url: &str,
subscriptions_endpoint_url: Option<&str>, subscriptions_endpoint_url: Option<&str>,
) -> content::Html<String> { ) -> content::RawHtml<String> {
content::Html(juniper::http::graphiql::graphiql_source( content::RawHtml(juniper::http::graphiql::graphiql_source(
graphql_endpoint_url, graphql_endpoint_url,
subscriptions_endpoint_url, subscriptions_endpoint_url,
)) ))
@ -57,8 +57,8 @@ pub fn graphiql_source(
pub fn playground_source( pub fn playground_source(
graphql_endpoint_url: &str, graphql_endpoint_url: &str,
subscriptions_endpoint_url: Option<&str>, subscriptions_endpoint_url: Option<&str>,
) -> content::Html<String> { ) -> content::RawHtml<String> {
content::Html(juniper::http::playground::playground_source( content::RawHtml(juniper::http::playground::playground_source(
graphql_endpoint_url, graphql_endpoint_url,
subscriptions_endpoint_url, subscriptions_endpoint_url,
)) ))