luraproject / lura

Ultra performant API Gateway with middlewares. A project hosted at The Linux Foundation
https://luraproject.org
Other
6.35k stars 563 forks source link

How to add a graphql backend #316

Closed devopsprosiva closed 4 years ago

devopsprosiva commented 4 years ago

Hi,

One of the backend services for my app uses graphql api. How can I add that as a backend and expose it as an endpoint in krakend?

kpacha commented 4 years ago

I'm not a graphQL expert, but following the specs, I'd go with this configuration (after tuning the backend host and endpoints):

{
    "version": 2,
    "name": "My lovely gateway",
    "port": 8000,
    "cache_ttl": "3600s",
    "timeout": "1s",
    "host": [ "http://graphql" ],
    "endpoints": [
        {
            "endpoint": "/graphql",
            "querystring_params": ["query"],
            "backend": [
                { "url_pattern": "/graphql" }
            ]
        },
        {
            "endpoint": "/graphql",
            "querystring_params": ["query"],
            "method": "POST",
            "headers_to_pass": ["Content-Type"],
            "backend": [
                { "url_pattern": "/graphql" }
            ]
        }
    ]
}
github-actions[bot] commented 2 years ago

This issue was marked as resolved a long time ago and now has been automatically locked as there has not been any recent activity after it. You can still open a new issue and reference this link.