forked from projectmoon/tenebrous-dicebot
Remove some warnings in API
This commit is contained in:
parent
d94451897c
commit
96330e13e4
|
@ -1,8 +1,7 @@
|
||||||
use crate::config::{create_config, Config};
|
use crate::config::create_config;
|
||||||
use crate::schema::{self, Context, Schema};
|
use crate::schema::{self, Context, Schema};
|
||||||
use log::info;
|
use log::info;
|
||||||
use rocket::http::Method;
|
use rocket::http::Method;
|
||||||
use rocket::serde::{json::Json, Deserialize};
|
|
||||||
use rocket::{response::content, Rocket, State};
|
use rocket::{response::content, Rocket, State};
|
||||||
use rocket_cors::AllowedOrigins;
|
use rocket_cors::AllowedOrigins;
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
|
@ -1,36 +1,3 @@
|
||||||
use log::info;
|
|
||||||
use rocket::http::Method;
|
|
||||||
use rocket::serde::{json::Json, Deserialize};
|
|
||||||
use rocket::{response::content, Rocket, State};
|
|
||||||
use rocket_cors::AllowedOrigins;
|
|
||||||
use std::env;
|
|
||||||
use tenebrous_api::config::{create_config, Config};
|
|
||||||
use tenebrous_api::schema::{self, Context, Schema};
|
|
||||||
use tracing_subscriber::filter::EnvFilter;
|
|
||||||
|
|
||||||
#[rocket::get("/")]
|
|
||||||
fn graphiql() -> content::Html<String> {
|
|
||||||
juniper_rocket_async::graphiql_source("/graphql", None)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[rocket::get("/graphql?<request>")]
|
|
||||||
async fn get_graphql_handler(
|
|
||||||
context: &State<Context>,
|
|
||||||
request: juniper_rocket_async::GraphQLRequest,
|
|
||||||
schema: &State<Schema>,
|
|
||||||
) -> juniper_rocket_async::GraphQLResponse {
|
|
||||||
request.execute(&*schema, &*context).await
|
|
||||||
}
|
|
||||||
|
|
||||||
#[rocket::post("/graphql", data = "<request>")]
|
|
||||||
async fn post_graphql_handler(
|
|
||||||
context: &State<Context>,
|
|
||||||
request: juniper_rocket_async::GraphQLRequest,
|
|
||||||
schema: &State<Schema>,
|
|
||||||
) -> juniper_rocket_async::GraphQLResponse {
|
|
||||||
request.execute(&*schema, &*context).await
|
|
||||||
}
|
|
||||||
|
|
||||||
#[rocket::main]
|
#[rocket::main]
|
||||||
pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
tenebrous_api::api::run().await?;
|
tenebrous_api::api::run().await?;
|
||||||
|
|
Loading…
Reference in New Issue