/simple-subscription-server

PubSub with apollo, minimal example

Primary LanguageJavaScript

Purpose

Demonstrate the simplest possible example of an apollo subscription

To use

npm i
node .

open http://localhost:3000/graphiql in two windows and arrange them side by side. In the first paste the following subscription and run it

subscription s{
  feedbackAdded {
    id
    text
  }
}

You should see "Your subscription data will appear here after server publication!"

In the second window run the following.

mutation m {
  addFeedback(data:{text:"thanks for making this awesome example"}) {
    id
  }
}

You should see your subscriptions appearing in the first window.