Giter Club home page Giter Club logo

graphql-playground's Introduction

GraphQL Playground

Playground to test and play with GraphQL schema and queries. The project utilises Scala and Sangria - GraphQL Implementation.

Run

After cloning the project, simply run the following command:

sbt run

How to use

  1. Via GraphiQL console

  2. Via Command Line

# returns all movie data
curl -X POST localhost:8080/graphql \
-H "Content-Type:application/json" \
-d '{"query": "{movies {movieInfo {title, releaseDate, genre}, cast {name}}}"}'

# returns movie data based on movie id
curl -X POST localhost:8080/graphql \
-H "Content-Type:application/json" \
-d '{"query": "query($id: Int!){movie(id: $id) {movieInfo {title, releaseDate, genre}, cast {name}}}", "variables": {"id": 1}}'

Content

Content displayed in the response is based on the moviesData.json static file, by default. If you want to experiment with an actual database connection, you may do so by updating the sql config in application.conf:

useDbConnection = true

# Optional - Only required if 'useDbConnection' is true
sql {
    host = "<HOST>"
    port = <PORT> 
    database = "<DATABASE NAME>"
    username = "<USERNAME>"
    password = "<PASSWORD>"
}

A moviesData.sql file has already been prepared to create the required tables accordingly. (Only Postgresql is supported at the moment.)

graphql-playground's People

Contributors

hamsyari avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.