Skip to content

Instantly share code, notes, and snippets.

@shantanoo-desai
Created August 11, 2019 16:59
Show Gist options
  • Save shantanoo-desai/0d356fbf944c1e2d68810783768d0290 to your computer and use it in GitHub Desktop.
Save shantanoo-desai/0d356fbf944c1e2d68810783768d0290 to your computer and use it in GitHub Desktop.
Apollo GraphQL Schema for querying sensors and subscription
const { gql } = require('apollo-server-express');
const typeDefs = gql`
type SensorData {
temp: Float!
humid: Float!
time: String!
}
type Subscription {
subscribe2sensor(topic: String!): SensorData!
}
type Sensors {
id: String!
}
type Query {
sensors: [Sensors!]!
}
schema {
query: Query
subscription: Subscription
}
`;
module.exports = { typeDefs };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment