Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/globaz/prod_global4net_com/wp-config.php:1) in /usr/www/users/globaz/prod_global4net_com/wp-content/plugins/handl-utm-grabber-v3/handl-utm-grabber-v3.php on line 269

Warning: Undefined array key "HandLtestDomainNameServer" in /usr/www/users/globaz/prod_global4net_com/wp-content/plugins/handl-utm-grabber-v3/handl-utm-grabber-v3.php on line 303

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/globaz/prod_global4net_com/wp-config.php:1) in /usr/www/users/globaz/prod_global4net_com/wp-content/plugins/handl-utm-grabber-v3/handl-utm-grabber-v3.php on line 219

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/globaz/prod_global4net_com/wp-config.php:1) in /usr/www/users/globaz/prod_global4net_com/wp-content/plugins/handl-utm-grabber-v3/handl-utm-grabber-v3.php on line 219

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/globaz/prod_global4net_com/wp-config.php:1) in /usr/www/users/globaz/prod_global4net_com/wp-content/plugins/handl-utm-grabber-v3/handl-utm-grabber-v3.php on line 219

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/globaz/prod_global4net_com/wp-config.php:1) in /usr/www/users/globaz/prod_global4net_com/wp-content/plugins/handl-utm-grabber-v3/handl-utm-grabber-v3.php on line 219

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/globaz/prod_global4net_com/wp-config.php:1) in /usr/www/users/globaz/prod_global4net_com/wp-content/plugins/handl-utm-grabber-v3/handl-utm-grabber-v3.php on line 219

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/globaz/prod_global4net_com/wp-config.php:1) in /usr/www/users/globaz/prod_global4net_com/wp-content/plugins/handl-utm-grabber-v3/handl-utm-grabber-v3.php on line 269

Warning: Undefined array key "HandLtestDomainNameServer" in /usr/www/users/globaz/prod_global4net_com/wp-content/plugins/handl-utm-grabber-v3/handl-utm-grabber-v3.php on line 303

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/globaz/prod_global4net_com/wp-config.php:1) in /usr/www/users/globaz/prod_global4net_com/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/globaz/prod_global4net_com/wp-config.php:1) in /usr/www/users/globaz/prod_global4net_com/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/globaz/prod_global4net_com/wp-config.php:1) in /usr/www/users/globaz/prod_global4net_com/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/globaz/prod_global4net_com/wp-config.php:1) in /usr/www/users/globaz/prod_global4net_com/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/globaz/prod_global4net_com/wp-config.php:1) in /usr/www/users/globaz/prod_global4net_com/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/globaz/prod_global4net_com/wp-config.php:1) in /usr/www/users/globaz/prod_global4net_com/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/globaz/prod_global4net_com/wp-config.php:1) in /usr/www/users/globaz/prod_global4net_com/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/globaz/prod_global4net_com/wp-config.php:1) in /usr/www/users/globaz/prod_global4net_com/wp-includes/rest-api/class-wp-rest-server.php on line 1831
{"id":6275,"date":"2021-06-08T15:00:31","date_gmt":"2021-06-08T13:00:31","guid":{"rendered":"https:\/\/global4net.co.uk\/?p=6275"},"modified":"2023-11-10T14:36:10","modified_gmt":"2023-11-10T13:36:10","slug":"magento-2-optimization-with-graphql","status":"publish","type":"post","link":"https:\/\/global4net.com\/en\/blog\/magento-cms\/magento-2-optimization-with-graphql\/","title":{"rendered":"Magento 2: Optimization with GraphQL"},"content":{"rendered":"

If we were to learn something from the IT industry, it would certainly be the fact that everything can be optimized. Surely, it won’t always be a big change, however, your solution is going to be better. It shows that progress is not rapid and sudden. During the majority of the time, the process of advancement is slow but steady and unyielding. It is especially true for e-Commerce platform optimization and we’ll be talking about one of the most popular of them \u2013 Magento. After reading this article you will know how to start optimization in Magento 2 using GraphQL<\/strong>.<\/p>\n

How can you optimize server-client communication in Magento 2 with GraphQL?<\/h2>\n

Magento 2<\/a><\/strong> is an e-commerce platform used by professionals all around the world for online store building and maintenance. As the saying goes, “The customer is always right”. So, if the e-customer wants speed, the e-commerce owners have to maximally optimize their sites so they provide the fastest and most comfortable experience. <\/strong>It’s right here that the GraphQL technology enters. But how does it work and how can it optimize site communication in Magento 2?<\/p>\n

What is GraphQL?<\/h3>\n

GraphQL is an open-source query language for API systems. It was created by Facebook back in 2012, but today it is supported by the GraphQL Foundation<\/a><\/strong>. The foundation was established by Facebook owners in order to further advance GraphQL on a non-profit basis. As a result of this, a growing community of developers has picked interest in the query language. Today it is one of the more popular ones. It contains numerous libraries that allow other platforms to utilize GraphQL, both on the backend and on the front. Two of the GraphQL libraries are included in the Magento<\/a> 2 tech stack: webonyx\/graphql-php<\/strong> (server-side) and Apollo Graphql Nano<\/strong> (client-side).<\/p>\n

How does GraphQL work?<\/h3>\n

GraphQL uses queries to efficiently and flexibly obtain data and information needed for responses to website users’ actions. The system sends requests in protocol HTTP and HTTPS. In return, it receives responses written in JSON format<\/strong> \u2013 a language based on JavaScript, created for intersystem data exchange. However, before the query is sent you have to ensure that it is compatible with the predefined schema on the server. Additionally, in GraphQL the properties of data downloaded from the backend depend on the type of request:<\/p>\n