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: 2 months ago
JSON representation
GQLEngine is the best productive solution for implementing a GraphQL server 🚀
- Host: GitHub
- URL: https://github.com/gqlengine/gqlengine
- Owner: gqlengine
- Created: 2020-01-03T15:54:32.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-05-08T05:48:03.000Z (over 4 years ago)
- Last Synced: 2024-06-19T00:39:39.407Z (7 months ago)
- Language: Go
- Homepage:
- Size: 1.99 MB
- Stars: 89
- Watchers: 7
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE-2.0.txt
Awesome Lists containing this project
- go-awesome - GQLEngine - based on the graphql-go implementation (Open source library / Query Language)
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 mainimport (
"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 maintype 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