const sdk = require('hasura-sdk');
sdk.init({
endpoint: 'http://localhost:8080/v1/query',
adminSecret: 'your-secret',
});
/**
* BASIC CALLS
*/
// Run plain SQL:
await sdk.query('SELECT NOW()');
// Run SQL with variable substitution:
await sdk.query({
sql: 'SELECT * FROM table_name WHERE field_name = $value',
binds: {
value: 'foo',
},
});
// Call any API method:
await sdk.call({
type: 'xxx',
args: { ... },
});
/**
* CUSTOM CALLS
* (full list in `lib/api.js`)
*/
// Track a table
await sdk.trackTable({
schema: 'public',
name: 'my_table',
});
marcopeg/hasura-sdk
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Utilities to deal with Hasura's API
Resources
Stars
Watchers
Forks
Packages 0
No packages published