Skip to content

A GraphQL server example written in GoLang integrating with Cassandra and MongoDB.

License

Notifications You must be signed in to change notification settings

nilstgmd/graphql-starter-kit

Repository files navigation

GraphQL Starter Kit for GoLang

Golang implementation of a GraphQL server using Cassandra, MongoDB and REST backends inspired by Tutorial: How to build a GraphQL server.

Quick Start

Get the code:

go get github.com/nilstgmd/graphql-starter-kit

Start the Docker container running the GraphQL server, a container with Cassandra and a container with MongoDB (showterm.io):

cd  $GOPATH/src/github.com/nilstgmd/graphql-starter-kit/ && make all

Use the GraphiQL IDE in your browser http://localhost:8080/ or the API http://localhost:8080/graphql?query=... to execute queries against the server.

GraphiQL IDE

Example

Using GraphiQL:

{
  author(firstName:"Rob", lastName: "Pike"){
    firstName
    lastName
    posts{
      title
      views
    }
  }
  getFortuneCookie
}

Using cURL:

curl -XPOST http://localhost:8080/graphql \
-H 'Content-Type: application/graphql' \
-d 'query Root{ author(firstName:"Andrew",lastName:"Gerrand"){firstName,lastName,posts{title,views}},getFortuneCookie }'

Extra

Just because it is cool: Flamegraphs 🔥

Flamegraph

The GraphQL server offers a pprof endpoint which can be consumed to create flamegraphs with go-torch.

About

A GraphQL server example written in GoLang integrating with Cassandra and MongoDB.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published