I'm building a new project in Golang world and I wanna try this amazing framework. What do you think about GraphQL?
Is it worth having a framework like Gin for this purpose?
If I search "graphql" in these issues nothing appears.
I'm using Gin with GraphQL and it's work like a charm. You just need to create a custom handler to handle your graphql query.
I can provide you some example for the handler if you need.
@mrkongo create the gin middleware:
package graphql
import (
"github.com/go-ggz/ggz/schema"
"github.com/gin-gonic/gin"
"github.com/graphql-go/handler"
)
// Handler initializes the prometheus middleware.
func Handler() gin.HandlerFunc {
// Creates a GraphQL-go HTTP handler with the defined schema
h := handler.New(&handler.Config{
Schema: &schema.Schema,
Pretty: true,
})
return func(c *gin.Context) {
h.ServeHTTP(c.Writer, c.Request)
}
}
in router:
g := e.Group("/graphql")
g.Use(auth0.Check())
{
g.POST("", graphql.Handler())
}
try it.
Did Gin support subscription of GraphQL
Most helpful comment
@mrkongo create the gin middleware:
in router:
try it.