stefanorg/graphql-expressive-demo

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Demo of graphql middleware

This package is not auto-updated.

Last update: 2021-12-05 23:47:57 UTC


README

This is a demo application that show how to integrate php graphql-middleware with zend expressive and doctrine

Like Youshido/GraphQLDemoApp demo app, this demo mimic the React TODO app

Running the application

Docker Container

You can you use docker to run the application. Copy docker-compose.local.dist to docker-compose.local and modify to your needs.

start the container

  • ./contaniner.sh start or docker-compose up

install deps

  • ./contaniner.sh composer install

Configurations setup

  • Copy config/autoload/doctrine.local.php.dist to config/autoload/doctrine.local.php by default sqlite is used and the db is stored in data/sqlite.db
  • Setting up the db with:
./contaniner.sh php bin/doctrine orm:schema-tool:update --force

GraphiQL

Opening your browser to http://localhost or your docker environment address, you can use the GraphiQL interface to interact with the server.

Sending Requests

You can send:

  • GET request to the /graphql uri
http://localhost/graphql?query={todos}
  • POST request using the application/graphql header
curl -X POST -H "Content-Type: application/json" -H "Content-Type: application/graphql" -d '{
	todos {
		id,
		title
	}
}' "http://localhost/"

Credits:

This demo is build to show how to use php GraphQL Middleware with zend expressive