Skip to content

larsroettig-dev/graphql-workshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A GraphQL training for Magento 2

This repository hold all my workshop material for give a GraphQL training presentations would be in german but code is in english.

Requirements:

Preparation before training can start

composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition graphqlworkshop
valet.sh db create graphqlworkshop
cd graphqlworkshop
valet.sh link graphqlworkshop php73
php7.3 bin/magento setup:install --base-url=https://graphqlworkshop.test/ --db-host=localhost --db-name=graphqlworkshop --db-user=root --db-password=root --admin-firstname=Magento --admin-lastname=User --admin-email=user@example.com --admin-user=admin --admin-password=admin123 --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1 --search-engine=elasticsearch7 --elasticsearch-port=9207 

What we learn

  • What is GraphQL
  • Difference to Rest
  • Basic Query and Syntax based on (Apollo server)
  • GraphQL Mutation (Apollo server)
  • Difference from GraphQL spec to magento implementation
  • How to develop a Basic Magento Module
  • How to develop a Basic Magento GraphQL Module
  • How to develop a GraphQL Query
  • How to develop a GraphQL Query Filter
  • How to develop a GraphQL Mutation
  • GraphQL Security basics
  • How to add unit test
  • How do cover your Module with an Integration test

What is GraphQL and Difference to Rest

@todo

Apollo server basic

Basic Magento GraphQL Module

I will show how you can build your GraphQL for Magento 2.4 and extend them with a filter logic. Our use case is a Product review endpoint.

As a frontend developer, I need Endpoint to search for the next Pickup Store in a Postcode Area. Use a setup script initial import Allow search for Postcode or Name. API will return the following attributes for a Pickup Store.

Attribute Name GraphQL field Data Type
Name name string
Postcode postcode string
Street street string
Street Number street_num int
City city string
Longitude longitude decimal
Latitude latitude decimal

About

GraphQL Workshop for Magento

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published