Skip to content

Commit

Permalink
fix: move graphql under /graphql only
Browse files Browse the repository at this point in the history
  • Loading branch information
ctron committed Jun 18, 2024
1 parent ebc55bd commit f07f5fa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
8 changes: 2 additions & 6 deletions modules/graphql/src/endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,12 @@ pub fn configure(svc: &mut web::ServiceConfig, db: Database, graph: Arc<Graph>)
.finish();

svc.service(
web::resource("/graphql")
web::resource("/")
.guard(guard::Post())
.to(GraphQL::new(schema.clone())),
);
}

pub fn configure_graphiql(svc: &mut web::ServiceConfig) {
svc.service(
web::resource("/graphql")
.guard(guard::Get())
.to(index_graphiql),
);
svc.service(web::resource("/").guard(guard::Get()).to(index_graphiql));
}
24 changes: 11 additions & 13 deletions server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,20 +267,18 @@ impl InitData {
openapi::openapi(),
swagger_oidc.clone(),
));
svc.service(web::scope("/").wrap(new_auth(self.authenticator.clone())))
.configure(|svc| {
trustify_module_graphql::endpoints::configure(
svc,
db.clone(),
graph.clone(),
);
});
svc.service(
web::scope("/").wrap(new_auth(self.authenticator.clone())), // .wrap(Cors::permissive()),
)
.configure(|svc| {
trustify_module_graphql::endpoints::configure_graphiql(svc);
});
web::scope("/graphql")
.wrap(new_auth(self.authenticator.clone()))
.configure(|svc| {
trustify_module_graphql::endpoints::configure(
svc,
db.clone(),
graph.clone(),
);
trustify_module_graphql::endpoints::configure_graphiql(svc);
}),
);
svc.app_data(web::Data::from(self.graph.clone()))
.service(
web::scope("/api")
Expand Down

0 comments on commit f07f5fa

Please sign in to comment.