youshido-php / GraphQLBundle

Pure PHP implementation of GraphQL Server – Symfony Bundle
MIT License
284 stars 44 forks source link

Multiple Endpoints #54

Closed BowlingX closed 7 years ago

BowlingX commented 7 years ago

Is it possible to support multiple endpoints with different schemas in a single Application? I think this is similar to https://github.com/Youshido/GraphQLBundle/issues/14. Composing a schema can be solved already with DI tags and manual merging in the schema class, but independent endpoints for multiple bundles in the same symfony application is not possible right now.

geotry commented 7 years ago

Yes you can, I don't know if it's the right way to do it but it works for me:

/**
 * @Route("/graphql/public")
 */
public function graphqlPublicAction(Request $request)
{
    $this->container->set('graphql.schema', new PublicSchema());
    return $this->forward('GraphQLBundle:GraphQL:default', [], $request->request->all());
}