strapi-plugin-graphqlproxy

0.1.21 • Public • Published

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

Package Sidebar

Install

npm i strapi-plugin-graphqlproxy

Weekly Downloads

3

Version

0.1.21

License

MIT

Unpacked Size

9.96 kB

Total Files

7

Last publish

Collaborators

  • linulas
  • kiten
  • fontanka16
  • dajjen
  • miax_
  • kopin01