Client for the autohub key-value store.
const { connect } = require('autohub-client');
// Initialize the client
const client = connect({
baseUrl: 'https://your-autohub-server.com',
token: 'your-auth-token',
});
// Upsert data to a collection
async function example() {
try {
const result = await client.upsert({
scope: 'users',
rows: [
{ id: 1, name: 'John Doe', email: 'john@example.com' },
{ id: 2, name: 'Jane Smith', email: 'jane@example.com' },
],
});
console.log('Upsert successful:', result);
} catch (error) {
console.error('Error:', error.message);
if (error.status) {
console.error('Status:', error.status);
}
if (error.text) {
console.error('Response:', error.text);
}
}
}
- Clone the repository:
git clone <repository-url>
cd autohub-client
- Install dependencies:
npm install
- Set up Git hooks (automatically done during installation):
npm run prepare
ISC