Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/gqlengine/gqlengine

GQLEngine is the best productive solution for implementing a GraphQL server 🚀
https://github.com/gqlengine/gqlengine

Last synced: 11 days ago
JSON representation

GQLEngine is the best productive solution for implementing a GraphQL server 🚀

Lists

README

        

# *GQLEngine* is the best productive solution for implementing a graphql server for highest formance

## examples

- starwars: https://github.com/gqlengine/starwars
- chatbox: https://github.com/gqlengine/chatbox

## Getting started

Get the module:

```
go get -u github.com/gqlengine/gqlengine
```

main.go

```go
package main

import (
"net/http"

"github.com/gqlengine/gqlengine"
)

func main() {
engine := gqlengine.NewEngine(gqlengine.Options{
Tracing: true, // enable tracing extensions
})

// register your queries, mutations and subscriptions
engine.NewQuery(mySimpleQuery)

// do NOT forget init the engine
if err := engine.Init(); err != nil {
panic(err)
}

// serve for HTTP
http.HandleFunc("/api/graphql", engine.ServeHTTP)
if err := http.ListenAndServe(":8000", nil); err != nil {
panic(err)
}
}
```

api.go

```go
package main

type MyInfo struct {
gqlengine.IsGraphQLObject `gqlDesc:"my info"`
SaySomething string
}

func mySimpleQuery() error {
panic("not implemented")
}
```

use playground

```
go get -u github.com/gqlengine/playground
```

update the code

```go

...

import (
"github.com/gorilla/mux"
"github.com/gqlengine/playground"
)

...

func main() {

... // init your gql engine

playground.SetEndpoints("/api/graphql", "/api/graphql/subscriptions")

// recommends to use 'gorilla/mux' to serve the playground web assets
r := mux.NewRouter()
r.HandleFunc("/api/graphql", engine.ServeHTTP)
r.HandleFunc("/api/graphql/subscriptions", engine.ServeWebsocket)
r.PathPrefix("/api/graphql/playground").
Handler(http.StripPrefix("/api/graphql/playground",
http.FileServer(playground.WebBundle)))

println("open playground http://localhost:9996/api/graphql/playground/")
if err := http.ListenAndServe(":9996", r); err != nil {
panic(err)
}
}

```

open browser, you can get the [playground](http://localhost:9996/api/graphql/playground) all in box

## Features

- Basic features
- [x] Object type reflection
- [x] Interface pre-register
- [x] Union pre-register
- [x] Enum reflection
- [x] Scalar reflection
- [x] Input reflection
- [x] Arguments reflection
- [x] Subscription (Integerates Websocket)
- [x] Multipart Upload (Upload images/files in graphql query)
- [x] Custom ID
- [x] Tracing extensions
- [x] document tags
- [x] operation hijacking