graphql-go-demo

command module
v0.0.0-...-4b43d43 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2018 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

graphql-go-demo

A Graphql server demo built in Go using (graphql/graphql-go)[https://github.com/graphql-go/graphql].

The server is backed by a mysql database and exposes Post and Comment models

Installation

Clone this repository

git clone https://github.com/zianwar/go-graphql-demo

Install dependencies

go get ./...

Database configuration

  • Run the SQL query in the up.sql file.

  • Update the credentials in main.go to match your database config

    The default config ones are:

    Host: localhost
    User: root
    Password: ''
    Db Name: graphqlgodemo
    

Usage

Start the server using: go build && ./graphql-go-demo.

You can try these queries:

  • Get titles of all posts

    query {
      posts {
        title
      }
    }
    

    query1

  • Get titles of all posts and their comments

    query {
      posts {
        title
        comments {
          body
        }
      }
    }
    

    query1

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址