Hi, thanks for the helpful article, I have question regarding typeDefs files, are they mandatory…
Huy Giang
1

I’m not sure if I understood your question. typeDefs stands for type definitions, which in the Apollo stack — with the help of makeExecutableSchema — means a string which will be used to generate the actual GraphQL server’s schema. There exists no GraphQL server without a schema. This has nothing to do with a possible REST API wrap up.

Having that said, typeDefs are mandatory to any Apollo created schema.

If at any point in time you replace your API with a fully enabled GraphQL API, this typeDefs and schema building will still exists — but on the server side, not the client. When that happens, my article and the whole idea of the custom network layer proposed here should be probably dropped and replaced with the default Apollo client usage — which is to point GraphQL request to an specific URL address and let the server-side code solve your queries as usual.

Did this answer it for you? I suggest you join the Apollo Slack for further information, should you have any doubts not relevant to this article ;)

Show your support

Clapping shows how much you appreciated Lucas Constantino Silva’s story.