Web API, Web UI #86

Merged
projectmoon merged 37 commits from web-api into master 2021-07-15 15:04:54 +00:00
2 changed files with 1 additions and 35 deletions
Showing only changes of commit 96330e13e4 - Show all commits

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?;