WIP subscription support, will require switching webserver
This commit is contained in:
@@ -14,7 +14,7 @@ use letterbox_server::tantivy::TantivyConnection;
|
||||
use letterbox_server::{
|
||||
config::Config,
|
||||
error::ServerError,
|
||||
graphql::{Attachment, GraphqlSchema, Mutation, QueryRoot},
|
||||
graphql::{Attachment, GraphqlSchema, Mutation, QueryRoot, Subscription},
|
||||
nm::{attachment_bytes, cid_attachment_bytes},
|
||||
};
|
||||
use rocket::{
|
||||
@@ -159,7 +159,12 @@ async fn original(
|
||||
|
||||
#[rocket::get("/")]
|
||||
fn graphiql() -> content::RawHtml<String> {
|
||||
content::RawHtml(GraphiQLSource::build().endpoint("/api/graphql").finish())
|
||||
content::RawHtml(
|
||||
GraphiQLSource::build()
|
||||
.endpoint("/api/graphql")
|
||||
.subscription_endpoint("/api/graphql")
|
||||
.finish(),
|
||||
)
|
||||
}
|
||||
|
||||
#[rocket::get("/graphql?<query..>")]
|
||||
@@ -222,7 +227,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||
let tantivy_conn = TantivyConnection::new(&config.newsreader_tantivy_db_path)?;
|
||||
|
||||
let cacher = FilesystemCacher::new(&config.slurp_cache_path)?;
|
||||
let schema = Schema::build(QueryRoot, Mutation, EmptySubscription)
|
||||
let schema = Schema::build(QueryRoot, Mutation, Subscription)
|
||||
.data(Notmuch::default())
|
||||
.data(cacher)
|
||||
.data(pool.clone());
|
||||
|
||||
Reference in New Issue
Block a user