This is a driver for all your pure-most Cycle apps (think Motorcycle) that talks to a GraphQL endpoint.
It uses Apollo Client underneath.
- the graphql endpoint defaults to
/graphql
, but it can be changed by passing theendpoint='/something'
option tomakeGraphQLDriver
; withCredentials
is enabled by default (and there's no way to change it);- to send custom headers with the GraphQL requests, it is possible to either
- specify the headers through the
headers={authorization: 'token xyz'}
option tomakeGraphQLDriver
; or - emit an object with a key
headers
(example:{headers: {authorization: 'token xyz'}}
) as an event in the stream that the driver is consuming.
- specify the headers through the
Install
npm install --save cycle-graphql-most-driver
Use
Cycle { let response$ = GRAPHQL let itemList$ = response$ let vtree$ = itemList$ return DOM: vtree$ GRAPHQL: most }