Why GraphQL?
Reference information
The easy part is using it, it only takes a call function that does something like this:
fetch('/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
},
body: JSON.stringify({query: "{ hello }"})
})
.then(r => r.json())
.then(data => console.log('data returned:', data));
more at https://graphql.org/graphql-js/graphql-clients/
The hard part is to set it up and understanding how to type schemas (this is news to all of us)
as per https://graphql.org/graphql-js/
npm init
npm install graphql --save
Optionally, you also have the option of setting GraphQL as BaaS --> we're using https://hasura.io/ today.
for today I'll leave my graphql endpoint public:
fetch('https://i2graph.herokuapp.com/v1alpha1/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
},
body: JSON.stringify({query: "{ lala { name } }"})
})
.then(r => r.json())
.then(data => console.log('data returned:', data));
Hands-on challenge:
insert your own mutations, recalling that Joe's was
mutation {
insert_lala(objects:[{name:"Joe"}]) {
affected_rows
}
}
Share your github deployments here as you go
https://blog.apollographql.com/4-simple-ways-to-call-a-graphql-api-a6807bcdb355
R client for GraphQL: https://github.com/ropensci/ghql
Reference tutorial list: https://js.tensorflow.org/tutorials
Let's do this one today, https://js.tensorflow.org/tutorials/fit-curve.html, either as a regular html application or as an observable notebook (or both)
Google has organized a full course on Machine learning, at https://developers.google.com/machine-learning/crash-course/descending-into-ml