GraphQL Demo App

Overview

GraphQL Demo App

This project was created to show how we use GraphQLBundle in our projects.

To ilustrate this we created simple backend application witch provide API endpoint for React Example TODO app (source code and how to run it you can see here).

How to run

To run backend you need clone this repo and:

  • If you have docker installed, just type this in project root:

    docker-compose up -d

    This command will run containers and exposed port will be 8500.

    API endpoint: http://localhost:8500/graphql

  • If you have web stack installed, run:

    php bin/console server:start

    API endpoint: http://localhost:8000/graphql

Sending requests

Now you can easily send request to endpoint, for example:

$ curl -XPOST 'http://127.0.0.1:8000/graphql'

Response:

{
    "errors": [
        {
            "message": "Must provide an operation."
        }
    ]
}

Now let's specify query in request content:

$ curl -XPOST 'http://127.0.0.1:8000/graphql' -F 'query={ todos { id } }'

Response:

{
    "data": {
        "todos": [
          {
            "id": 129
          }
        ]
    }
}

GraphiQL extension

To run GraphiQL extension, just open endpoint + /explorer in your browser, for example http://localhost:8000/graphql/explorer.

Configuration for React example Todo app

If you have installed React Example TODO application and want to use our endpoint, you need to change endpoint in server.js on line 10:

Example

You might also like...
Simple Symfony currency exchange demo application (CLI)

Symfony currency exchange demo Keynotes Using a small Symfony installation as possible Using SQLite database for simplicity but with price of some cav

Demo of symfony/console features to build rich command line utilities

Symfony Console Demo This project is a demonstration of symfony/console features. To run the project with Docker. With bash: docker build -t myconsole

The fixture plugin is really helpful if you want to create some static demo data for your shopware instance.

Fixture Plugin The fixture plugin is really helpful if you want to create some static demo data for your shopware instance. Installation Just add it t

PHP demo application showing how to access the Hubstaff Public API

Public API PHP Demo This repository contains a simple sample cli tool that shows off how to access the Hubstaff public api via PHP. The core access is

DashX Demo Backend written in PHP
DashX Demo Backend written in PHP

Your All-in-One Product Stack Website | Demos | Documentation dashx-demo-php This repository contains a sample application that demonstrates various f

Demo Silverstripe and JavaScript sources for Lightning Talk
Demo Silverstripe and JavaScript sources for Lightning Talk "FormField Mini Apps" at StripeCon EU 2022

Watch the Lightning Talk on Youtube 📺 Demo repository for Lightning Talk "FormField Mini Apps with the JavaScript framework/lib/style of your choice"

Get mobile app version and other related data from Google Play Store, Apple App Store and Huawei AppGallery

Mobile App Version Get mobile app version and other related data from Google Play Store, Apple App Store and Huawei AppGallery. Installation Add to co

This is an example app demonstrating how to deploy a php app to runway.

Runway Example php App This is an example app demonstrating how to deploy a php app to runway. clone this repo, and navigate into that directory runwa

HTMX example app that demonstrates how to use HTMX to add javascript interactivity to a serverside rendered PHP app

HTMX examle app This demo app demonstrates how to use HTMX to transform a server side rendered PHP app into a more 'interactive' app with AJAX request

Comments
  • Access denied error when running demo app for the first time

    Access denied error when running demo app for the first time

    I am trying to run the GraphQLDemoApp for the first time, so I downloaded the repo and run the command:

    php bin/console server:start

    I am getting the correct (error) response to 'http://127.0.0.1:8000/graphql' but when I am trying to specify query, this is what I get:

    | => curl -XPOST 'http://127.0.0.1:8000/graphql' -F 'query={ todos { id } }'
    {
        "errors": [
            {
                "message": "An exception occured in driver: SQLSTATE[HY000] [1045] Access denied for user \u0027root\u0027@\u0027localhost\u0027 (using password: YES)"
            }
        ]
    }
    

    What am I missing here?

    opened by kat-liger 0
  • Documentation

    Documentation

    Is it possible to create documentation that explains how to go from fresh install of the bundle, to responding with serialized entities? There seems to be discrepancies between the main bundle docs, and what's in the demo app. Also, it seems like a bit of a jump from "Hello World" to all the included additional files being used here. What do they do?
    Is the expectation that someone will just dig through the code and figure it out?

    opened by bjunc 0
Owner
null
A Magento 2 module that enables configurable CORS Headers on the GraphQL and REST APIs

Magento 2 CORS Magento Version Support Ever try to work with the Magento GraphQL API or REST API from your browser and see the following? Access to XM

Graycore, LLC 62 Dec 8, 2022
Vulnerable demo application for the race condition

Vulnerable PHP App (Race Condition) Environment setup: docker-compose up Environment verification: Connection Test: http://localhost/test.php Vulnera

ProjectDiscovery 7 Nov 29, 2022
The slides and demo files for my Alpine Day 2021 talk

Building a Better Dialog Austen Cameron - @austencam This repository contains the slides and demos for my talk from Alpine Day 2021. Below, you'll fin

Austen Cameron 9 Nov 16, 2021
Demo project for the API Platform / DDD Workshop

Workshop DDD x API Platform This is a demo project used for the DDD x API Platform Workshop by @chalasr & @mtarld from @coopTilleuls. Checkout git clo

Les-Tilleuls.coop 34 Dec 16, 2022
Very soykaf IB+BBS software. Work_In_Progress demo below.

ImoutoIB - Terrible imageboard software. But anon-san — if it's so terrible, Why should I use it? You probably shouldn't. It's not equipped to handle

ithrts 5 Jan 13, 2022
Phalcon Demo Application

Phalcon Demo Application We use modified Phalcon INVO Application to demonstrate basics of Codeception testing. We expect to implement as many feature

Codeception Testing Framework 42 Oct 7, 2022
Demo serverless applications, examples code snippets and resources for PHP

The Serverless LAMP stack Examples Code example Description AWS blog link 0.1-SimplePhpFunction A very simple implementation of a PHP Lambda function.

AWS Samples 303 Dec 20, 2022
Laravel & Google Drive Storage - Demo project with Laravel 6.x and earlier

Laravel & Google Drive Storage Demo project with Laravel 8.X Look at the commit history to see each of the steps I have taken to set this up. Set up t

null 23 Oct 3, 2022
Diese Demo demonstriert den Aufbau einer REDAXO Website mit UIKit3

UIKit3 Demo für REDAXO 5 Diese Demo demonstriert den Aufbau einer REDAXO Website mit UIKit3. Diese Demo benötigt eine utf8m4 kompatible Datanbank. Hin

Friends Of REDAXO 19 Jan 6, 2023
Notejam demo application using Blink framework

Notejam: Blink framework Notejam demo application using Blink framework Installation Clone the repository to you machine. Run vagrant up to create the

RAFIE Younes 6 Jun 4, 2018