strapi-plugin-graphqlproxy

Strapiv4 plugin, adds Apollo graphql federation support

Usage no npm install needed!

<script type="module">
  import strapiPluginGraphqlproxy from 'https://cdn.skypack.dev/strapi-plugin-graphqlproxy';
</script>

README

Strapi plugin graphqlproxy

Custom graphql endpoint plugin adds Apollo federation support to Strapis graphql via a proxy. The new schema will be a Apollo Subgraph on a different port, set in config

Also makes it possible to whitelist root fields on schema.

environment variables

#hostname for proxy subgraph
graphqlproxy_schemahost=localhost
#port for proxy subgraph
graphqlproxy_port=1303
#prefix added to each field (Apollo federation wont allow same field names across subgraphs)
graphqlproxy_schemaprefix=someweb
#disable mutations in schema
graphqlproxy_mutations=false
#whitelist root fields on schema, wildcards also possible
graphqlproxy_whitelistRootFields=pages,page,digg_*

Enable/disable in Strapi config

#edit/create config/plugins.js
module.exports = ({ env }) => ({    
    graphql: {     
        enabled: true,
        config: { 
            shadowCRUD: true,
            playgroundAlways: false,
            depthLimit: 7,
            amountLimit: 100,      
            apolloServer: {
            tracing: false        
            },
        }
    },
    graphqlproxy: {
        enabled: true,
        config:{
            strapigraphqlurl: env('graphqlproxy_strapigraphqlurl'),         
            port: env('graphqlproxy_port'),
            schemahost: env('graphqlproxy_schemahost'),            
            schemaprefix: env('graphqlproxy_schemaprefix')
            mutations: env('graphqlproxy_mutations'),
            whitelistRootFields: env('graphqlproxy_whitelistRootFields')
        }        
    }
});