graphql-tag icon indicating copy to clipboard operation
graphql-tag copied to clipboard

gql literal VS .graphql files (what is the recommended way?)

Open waterdrop01 opened this issue 4 years ago • 3 comments

Hello everyone,

I have a graphql API that I'm querying using javascript.

I have a gql.js file in which I write graphql queries using string literals.

I'm planning to write some services in Python in the future that will need to query the same graphql API as my javascript clients, and ideally I'd like to re-use the gql queries (sitting in the gql.js file currently).

What is the recommended approach? Should I write all my queries in .graphql file instead, so that I can reuse them among multiple languages (I'm looking at JS and Python mainly)?

Thanks a lot for your advices!

waterdrop01 avatar Jun 16 '20 08:06 waterdrop01

Any updates?

zenVentzi avatar Aug 13 '21 19:08 zenVentzi

Any updates ?

Tjerk-Haaye-Henricus avatar Jun 03 '23 21:06 Tjerk-Haaye-Henricus

use .gql or .graphql files

rehmat123 avatar Nov 17 '23 09:11 rehmat123