0.1.21 • Published 7 months ago

strapi-plugin-graphqlproxy v0.1.21

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

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=127.0.0.1
#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')
        }
    }
});