Apollo-Server subscription to Postgres database

Apollo-Server subscription to Postgres database


1

I have a postgres table (User) which is fed data from a third party service like Airflow or Nifi.
I am running an apollo-server with NodeJS which fetches the user data and passes this data to the React component.

One way to show the details of users is using polling in apollo-client which will query my postgres and fetch the data. But this would mean a server request at every specific interval.

I came across Subscription in apollo-server but don’t understand if this will work for my use case or not?

I want to understand if using Subscription, is there a way that I can subscribe to postgres from apollo-server everytime a new user entry is made and send the updated data to the subscribed react component in apollo-client

Can someone please help with any code sample or article or if anyone has done something like this?

PS: I do not have any code setup for this. Its a research that I’m trying to understand.

Share
Improve this question


Load 6 more related questions


Show fewer related questions

0

Reset to default



Leave a Reply

Your email address will not be published. Required fields are marked *