My blog: https://gebna.gg/
My blog: https://gebna.gg/
It's up to you whether you want to expose your schema publicly (enable introspection) or not. If your API is private in nature, you should disable introspection. You should also prevent unauthorised access to your HTTP server to prevent any schema exploration attacks. Disabling introspection won't disable schema validation. So you'll still have the contract of your API intact. Not abstracting away the data models is an anti pattern. You should always decouple your datastore implementation from your API. It doesn't matter if the API interface is GraphQL or something else. I hope this helps. And thanks a lot for reading.
Thanks for your comment. Even if you're not exposing schema introspection, schema validation still happens on every query. So you're still getting your contract enforced on runtime. As for the "legacy" bit. You're absolutely right. I just thought it would be a catchy title to bring people's attention to the fact that GQL is objectively superior. And that REST isn't enough for today's complicated APIs.
The .serialize method in the abstract class basically does nothing. It's existence and usage allows a subclass that chooses to reimplement it to have a more sophisticated serialization process without having to reimplement the other methods. The socket connects once you make an instance of "socket-io.client" (look at index.tsx in the client repo). We listen as long as the UI component is mounted (visible to the user basically). The moment it gets unmounted, we stop listening. (look at XO.tsx om the client repo). Thank you for reading. I hope I answered your questions.