Skip to content

junglejs/jungle-gateway-squidex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jungle-gateway-squidex

With this gateway you can load content from the headless cms Squidex. Squidex can be self hosted, or you use the hosted version on Squidex.io.

Configuration

/* jungle.config.js */

const gatewaySquidex = require('jungle-gateway-squidex');

module.exports = async () => {
    const token = await gatewaySquidex.getToken({
        client_id: SQUIDEX_CLIENT_ID,
        client_secret: SQUIDEX_CLIENT_SECRET,
        url: SQUIDEX_BASE_URL
    });

    const jungleGateway = junglePreprocess({
        gateways: {
            squidex: SQUIDEX_GRAPHQL_URL
        },
        gatewayContext: ctx => {
            if (ctx === "squidex") {
                const extraHeaders = {"X-Languages": "de"};
                return gatewaySquidex.gatewayContext(extraHeaders);
            }
            return {};
        },
        middlewareContext: {
            squidex: [
                gatewaySquidex.middlewareContext, // removes flatData, necessary if you use [slug].svelete
                {
                    Page: async (data) => {
                        data.content = marked(data.content);
                    }
                }
            ]
        }
    });
};


About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published