1.4.0 ā€¢ Published 3 years ago

@hoctail/query v1.4.0

Weekly downloads
1
License
MIT
Repository
-
Last release
3 years ago

Welcome to @hoctail/query

Version Documentation License: MIT

Hoctail query client is a low level API for browser and nodejs.

šŸ  Homepage

Install

yarn install @hoctail/query

Examples

import Client from '@hoctail/query'

const options = {
  baseURL: 'wss://api.hoctail.io', // Hoctail endpoint URL
  key: 'xxx-xxxx-xxxx-xxxxxxxxx', // your API key
  app: 'user@example.com/my-app', // your Hoctail app identifier
}
// create a client instance
// use `console.log()` as a default logger function
const client = new Client(options, console.log)

// run an SQL query on server
client.query('select * from users').then(console.log)

// call a public stored procedure on server
client.call('public.whoami').then(console.log)

// run a function in a server context
client.wait(() => {
  return `Hello ${hoc.userName}`
}).then(console.log)

// run an async function in a server context
// that fetches from a remote API
client.wait(async () => {
  const fetch = require('node-fetch')
  const res = await fetch('https://reqres.in/api/users/2')
  return await res.json()
}).then(console.log)

See the docs for a complete API documentation

Author

šŸ‘¤ Hoctail

šŸ¤ Contributing

Contributions, issues and feature requests are welcome!

Feel free to check issues page.

1.4.0

3 years ago

1.3.1

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago