Hacker News new | ask | show | jobs
by spocklivelong 2900 days ago
I work with a Django app on Postgres, and I'm not sure how I would migrate that to GraphQL. How things play out in terms of django specific tables? What about relationships between tables? We mostly use the Django app to expose REST APIs, which deal with making complex queries using QuerySets to Postgres. Moving this to GraphQL mean that all the business logic that sits on the REST APIs need to be moved to the frontend?
1 comments

Well it depends on your app. Technically, you have to rebuild your app to speak GraphQL to the frontend instead of REST. Internally, your GraphQL resolvers (like URL handlers) would then do similar work with using QuerySets as you're doing now.

If you'd like to leverage Hasura, it would be a good fit to potentially replace the "read" portions of your app with GraphQL quite easily. And then eventually you would have to move to writing a GraphQL gateway to handle some of the transactional logic and delegate the other stuff to Hasura via schema-stitching.