Graphql-go: A "idiomatic" endpoint name for either GraphiQL and requests

Created on 11 Dec 2017  路  1Comment  路  Source: graph-gophers/graphql-go

In order to use GraphiQL a route/endpoint needs to be declared:
https://github.com/neelance/graphql-go/blob/beff08417b04a91f0a7618b55786d63eec833b9f/example/starwars/server/server.go#L19

It fetches information from another one, /query in this case

https://github.com/neelance/graphql-go/blob/beff08417b04a91f0a7618b55786d63eec833b9f/example/starwars/server/server.go#L23

Can the latter be modified to something arbitrary (e.g, /api) and use a single endpoint for both? I mean this because not only query requests are sent to this endpoint, but mutation ones as well. it might sound trivial yet it's something meaningful for some of us.

Most helpful comment

Convention I've often seen in GraphQL backends is that POST /graphql is the query/mutation endpoint, and GET /graphql can be used to fetch the GraphiQL frontend. I've also seen GET /graphiql (with the "i") for the frontend.

That pattern has always made sense to me.

>All comments

Convention I've often seen in GraphQL backends is that POST /graphql is the query/mutation endpoint, and GET /graphql can be used to fetch the GraphiQL frontend. I've also seen GET /graphiql (with the "i") for the frontend.

That pattern has always made sense to me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LeeWong picture LeeWong  路  4Comments

Hagbarth picture Hagbarth  路  6Comments

0xTanvir picture 0xTanvir  路  5Comments

rogchap picture rogchap  路  5Comments

tonyghita picture tonyghita  路  3Comments