You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2021/05/04 10:28:49 UTC

[sling-org-apache-sling-graphql-core] branch master updated: Mention GraphQLServlet configuration

This is an automated email from the ASF dual-hosted git repository.

bdelacretaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-graphql-core.git


The following commit(s) were added to refs/heads/master by this push:
     new b1f9942  Mention GraphQLServlet configuration
b1f9942 is described below

commit b1f9942d4940f94e94592dc474c02b9dfbfcce08
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue May 4 12:28:44 2021 +0200

    Mention GraphQLServlet configuration
---
 README.md | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/README.md b/README.md
index 2cf4da5..07ea4fc 100644
--- a/README.md
+++ b/README.md
@@ -39,6 +39,24 @@ The GraphQL requests hit a Sling resource in all cases, there's no need for path
 
 See also the _caching_ section later in this file.
 
+## Configuring the GraphQL Servlet
+Here's an excerpt from an OSGi feature model file which uses the GraphQL Servlet provided by this module
+to serve `.json` requests for resources which have the `samples/graphql` resource type:
+
+    "configurations":{
+      "org.apache.sling.graphql.core.GraphQLServlet~default" : {
+        "sling.servlet.resourceTypes" : "samples/graphql",
+        "sling.servlet.extensions": "json",
+        "sling.servlet.methods": [ "GET", "POST" ]
+      },
+      "org.apache.sling.servlets.get.DefaultGetServlet" : {
+        "aliases" : [ "json:rawjson" ]
+      },
+      
+The `rawjson` selector is configured to provide Sling's default JSON output.
+
+See the `GraphQLServlet` class for more info.
+
 ## Resource-specific GraphQL schemas
 
 Schemas are provided by `SchemaProvider` services: