Created
August 11, 2019 16:59
-
-
Save shantanoo-desai/0d356fbf944c1e2d68810783768d0290 to your computer and use it in GitHub Desktop.
Apollo GraphQL Schema for querying sensors and subscription
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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