Better HN
topnewbestaskshowjobs
Log inSign up

nareshbhatia

3 karma · joined Aug 13, 2015 (11y ago) · 15 submissions

Submissions

comment 7y ago · link · parent

You guessed it–the last step, described in Part 7 of my GraphQL series, is to subscribe to events in our React client.

Thanks to the GraphQL and Apollo GraphQL teams for creating this awesome platform! I hope this series helps you apply GraphQL in real projects.

If you found the series helpful, please share it with your fellow developers. Until then, happy computing!

Here's a link back to Part 1 in case you missed it: "GraphQL concepts I wish someone explained to me a year ago" https://medium.com/naresh-bhatia/graphql-concepts-i-wish-som...

2.

Subscribing to GraphQL events in a React client(medium.com ↗)

3 points · by nareshbhatia · 7y ago · 1 comment

comment 7y ago · link · parent

Now comes the fun stuff in my GraphQL series–we'll use subscriptions to display changes to our bookstore in real-time. In Part 6, we'll implement subscriptions on the server using Apollo PubSub.

However, the default implementation of PubSub doesn't scale. More robust implementations are available, but not documented well. We'll create a pub/sub mechanism using Redis to distribute published messages over multiple servers.

I'll be releasing one part a day for the next week (in case you'd like some holiday travel reading). Here's what you can look forward to.

Part 7: Subscriptions (client implementation)

With only one part left in the series, I’d love to get your questions and comments.

4.

Pushing data in real time using GraphQL subscriptions(medium.com ↗)

5 points · by nareshbhatia · 7y ago · 1 comment

comment 7y ago · link · parent

In Part 5 of "GraphQL concepts I wish someone explained to me a year ago" we implement mutations on the client.

We'll use the operations exposed by the server to create authors, publishers and books as well as relationships between them.

I'll be releasing one part a day for the next week (in case you'd like some holiday travel reading). Here's what you can look forward to.

Part 6: Subscriptions (server implementation)

Part 7: Subscriptions (client implementation)

We’re on the home stretch now–are you enjoying the series so far?

6.

Using Apollo to implement mutations on a React client(medium.com ↗)

2 points · by nareshbhatia · 7y ago · 1 comment

comment 7y ago · link · parent

OK–more than half way through! In Part 4 of my GraphQL series, let's create some authors out of thin air and publish a few books. Implementing mutations on the server will help us with our whimsical mission.

I'll be releasing one part a day for the next week (in case you'd like some holiday travel reading). Here's what you can look forward to.

Part 5: Mutations (client implementation)

Part 6: Subscriptions (server implementation)

Part 7: Subscriptions (client implementation)

Have you gotten stuck at any point so far? I would love to get your questions and comments.

8.

Implementing mutations on a GraphQL server(medium.com ↗)

3 points · by nareshbhatia · 7y ago · 1 comment

comment 7y ago · link · parent

In Part 3 of my GraphQL series, we build querying capability into a freshly created React client.

We'll use Apollo Client's <Query> component. Also, we will cover the special case of executing multiple unrelated queries from a single React component.

Back when I first came across this use case, I was scratching my head

Just like we modularize code to make it reusable, we should do the same for queries. Fragments allow us to do this.

Despite careful documentation, it's easy to get client and server data structures out of sync – resulting in painful bugs.

I show you how to avoid this by generating TypeScript definitions from our schema and using them in React components.

10.

Querying a GraphQL API from React(medium.com ↗)

4 points · by nareshbhatia · 7y ago · 1 comment

comment 7y ago · link · parent

When I started learning GraphQL, I used to put all my resolvers into one file

Part 2 of my @GraphQL series shows you how to properly implement queries on your server.

If you missed part 1 (GraphQL basics), here it is: https://medium.com/naresh-bhatia/graphql-concepts-i-wish-som...

I'll be releasing one part a day for the next week (in case you'd like some holiday travel reading). Here's what you can look forward to.

Part 3: Queries (client implementation)

Part 4: Mutations (server implementation)

Part 5: Mutations (client implementation)

Part 6: Subscriptions (server implementation)

Part 7: Subscriptions (client implementation)

What have you struggled with in GraphQL? I'd love to hear your stories and make it easier to get started.

12.

Implementing queries on a GraphQL server(medium.com ↗)

4 points · by nareshbhatia · 7y ago · 1 comment

comment 7y ago · link · parent

Struggling to apply GraphQL to real projects? I did too.

In a recent blog article, npmjs co-founder @seldo commented that GraphQL will be a technical force to reckon with in 2019. He says there's a good chance you'll be using it in new projects.

I'd like to share the concepts (like scaling subscriptions) I learned the hard way. You'll notice I'm using a realistic example that has multiple entities and relationships. And it's relationships that cause us heartburn.

I'll be releasing one part a day for the next week (in case you'd like some holiday travel reading). Here's what you can look forward to.

Part 1: GraphQL Basics

Part 2: Queries (server implementation)

Part 3: Queries (client implementation)

Part 4: Mutations (server implementation)

Part 5: Mutations (client implementation)

Part 6: Subscriptions (server implementation)

Part 7: Subscriptions (client implementation)

What have you struggled with in GraphQL? I'd love to hear your stories and make it easier to get started.

14.

GraphQL concepts I wish someone explained to me a year ago(medium.com ↗)

6 points · by nareshbhatia · 7y ago · 1 comment

comment 11y ago · link · parent

Thanks for posting, nauman! If any of you are using Node.js and relational databases, you might have tried ORMs such as Sequelize, Bookshelf or Waterline. In my experience, these ORMs do not produce efficient queries required for production applications.

JoinJS gives you direct control over database interactions and maps query results easily to JavaScript objects. Would love to hear your thoughts and am happy to answer any questions here.