deepcase hasura
api
import { HasuraApi } from '@deepcase/hasura/api';
const api = new HasuraApi({
path: 'hasura.domain.com',
ssl: true,
secret: 'adminsecretkey'
});
sql template literal for ide highlighting
import { sql } from '@deepcase/hasura/sql';
await api.sql(sql`SELECT * FROM mytable`);
hasura api reference
await api.query({
type: 'track_table',
args: {
schema: 'public',
name: 'mytable',
}
});
client
import { generateApolloClient } from '@deepcase/hasura/client';
import gql from 'graphql-tag';
const client = generateApolloClient({
ws: true,
secret: 'adminSecretForRoot',
token: 'tokenFromCookiesOrLocalStorage',
ssl: true;
path: 'hasura.domain.com',
headers: {},
initialStore: {},
});
client.query({ query: gql`{ links { id }}` }).then(result => console.log(result))