/graphql-go-workshop

Source code of a simple GraphQL API that queries Meetup.com API retrieving events among their rsvps. Used as part of a live coding talk at GolangBCN November's 2018 Meetup.

Primary LanguageGoMIT LicenseMIT

graphql-go-workshop

Go Report Card

Source code of a simple GraphQL API that queries Meetup.com API retrieving events among their rsvps.

Used as part of a live coding talk at GolangBCN November's 2018 Meetup.

Workshop

Please refer to /docs.

Installation

Docker

docker run -p 8080:8080 -e WORKSHOP_MEETUPAPIKEY=<YOUR_MEETUP_APIKEY> smoya/graphql-go-workshop:latest

Source

This project requires Golang v1.11 or above since it relies in modules.

In order to build the app from source, make sure you clone this repo. Then run make build. Alternatively you can run:

GO111MODULE=on go build -o bin/graphql-go-workshop

Then just run WORKSHOP_MEETUPAPIKEY=<YOUR_MEETUP_APIKEY> bin/graphql-go-workshop

Usage

Open your browser and navigate to http://localhost:8080. You can use the GraphQL Playground in order to make GraphQL Queries against our API.

GraphQL Playground

Alternatively you can make GraphQL queries with any other client by using http://localhost:8080/query as endpoint.

Deployment

Kubernetes

This project includes some basic config files for deploying this GraphQL API in to a Kubernetes Cluster. You will find them at deployments/kubernetes.

Note that the service described in service.yaml will deploy a Kubernetes service of type LoadBalancer. That means that an Ingress Controller would be needed in order to create and assign external IP's to such service. I recommend you to use GKE or any similar cloud solution for a quick start.

kubectl create -f deployments/kubernetes

Alternatively you could deploy your API by using just the Deployment workload described in deployment.yaml and later associate to it your own service.