Deploy to Heroku and instantly get a realtime GraphQL API backed by Heroku Postgres:
Note the name of the app
| { | |
| "$schema": "http://json-schema.org/draft-07/schema#", | |
| "title": "MetadataObject", | |
| "anyOf": [ | |
| { | |
| "oneOf": [ | |
| { | |
| "title": "CompatibilityConfig", | |
| "type": "object", | |
| "required": [ |
| type Foo = {response: { foo: string}} | |
| type NullableFoo = Foo | null | |
| type ListFoo = Foo[] | |
| type Complex<T> = (((T | null)[][] | null) | null)[] | |
| type ComplexFoo = Complex<Foo> | |
| { | |
| "$schema": "http://json-schema.org/draft-07/schema#", | |
| "title": "SchemaResponse", | |
| "type": "object", | |
| "required": [ | |
| "collections", | |
| "functions", | |
| "object_types", | |
| "procedures", | |
| "scalar_types" |
| curl 'https://<project-name>.hasura.app/v1/graphql' \ | |
| -H 'content-type: application/json' \ | |
| --data-binary '{"query":"\n query IntrospectionQuery {\n __schema {\n queryType { name }\n mutationType { name }\n subscriptionType { name }\n types {\n ...FullType\n }\n directives {\n name\n description\n locations\n args {\n ...InputValue\n }\n }\n }\n }\n\n fragment FullType on __Type {\n kind\n name\n description\n fields(includeDeprecated: true) {\n name\n description\n args {\n ...InputValue\n }\n type {\n ...TypeRef\n }\n isDeprecated\n deprecationReason\n }\n inputFields {\n ...InputValue\n }\n interfaces {\n ...TypeRef\n }\n enumValues(includeDeprecated: true) {\n name\n description\n isDeprecated\n deprecationR |
| input LoginInfo { | |
| email: String | |
| password: String | |
| } | |
| type UserInfo { | |
| accessToken: String | |
| userId: Int | |
| } |
| todos ( | |
| id integer not null primary key, | |
| task text not null, | |
| created_at timestamptz default now, | |
| is_complete bool default false, | |
| user_id integer not null foreign key references users(id), | |
| update_mutation_identifier int default 0 | |
| ) |
| todos ( | |
| id int not null primary key, | |
| task text not null, | |
| created_at timestamptz default now, | |
| is_complete bool default false, | |
| user_id int not null foreign key references users(id) | |
| ) |
| // Installation | |
| // yarn add apollo-boost apollo-link-ws subscriptions-transport-ws react-apollo graphql | |
| // npm install --save apollo-boost apollo-link-ws subscriptions-transport-ws react-apollo graphql | |
| import React from 'react'; | |
| import { View, Text } from 'react-native'; | |
| import { ApolloClient } from 'apollo-client'; | |
| import { WebSocketLink } from 'apollo-link-ws'; | |
| import { InMemoryCache } from 'apollo-cache-inmemory'; |
| import React from 'react'; | |
| import { Subscription } from 'react-apollo'; | |
| import gql from 'graphql-tag'; | |
| const ConvertScreen = () => { | |
| const urlParams = new URLSearchParams(window.location.search); | |
| const id = urlParams.get('id'); | |
| return ( | |
| <Subscription |