Demonstrate how to feature toggle an internal working of a graphql endpoint.
Graphql query 'positions' returning data coming either from Hive or from SQL.
Use a boolean flag to switch between the two source.
type Query {
positions(useHive: Boolean!): [String]
}
This isn't ideal especially when working with a published public API.
See serverSimple.js
Consumers of this graphql service don't need to know where the data comes from. With LaunchDarkly we could also toggle the data source on the fly and even configure it based on the logged in user.
type Query {
positions: [String]
}
See server.js
I blogged about this for more background why I did this in the first place: http://velianarie.blogspot.com/2018/10/feature-toggling-graphql-service-with.html