Please help me
I am not able to access graphql schema and resolver from the custome module on localhost Xampp Server
Here is my code
/etc/graphql/schema.graphqls
type Query {
testHello: String @resolver(class: "modulename\modulename\Model\Resolver\TestHello")
}
Model/Resolver/TestHello.php
<?php
namespace ModulenameModuelnameModelResolver;
use MagentoFrameworkGraphQlQueryResolverInterface;
use MagentoFrameworkGraphQlSchemaTypeResolveInfo;
use MagentoFrameworkGraphQlConfigElementField;
class TestHello implements ResolverInterface
{
public function resolve(
Field $field,
$context,
ResolveInfo $info,
array $value = null,
array $args = null
) {
return "Hello from GraphQL!";
}
}
I have added in module.xml as well
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="modulename" setup_version="1.0.0">
<sequence>
<module name="Magento_Sales"/>
<module name="Magento_GraphQl"/>
</sequence>
</module>
</config>
Test query
query {
testHello
}
Please help and thanks in advance