Remove some warnings in API

This commit is contained in:
projectmoon 2021-06-09 15:56:20 +00:00
parent d94451897c
commit 96330e13e4
2 changed files with 1 additions and 35 deletions

View File

@ -1,8 +1,7 @@
use crate::config::{create_config, Config};
use crate::config::create_config;
use crate::schema::{self, Context, Schema};
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;

View File

@ -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]
pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
tenebrous_api::api::run().await?;