Skip to content

Instantly share code, notes, and snippets.

@bobvanluijt
Created March 26, 2023 17:28
Show Gist options
  • Save bobvanluijt/cd3b967cdf3dd92e0cf9ee229542c987 to your computer and use it in GitHub Desktop.
Save bobvanluijt/cd3b967cdf3dd92e0cf9ee229542c987 to your computer and use it in GitHub Desktop.
Connect to Weaviate using an API-key using JavaScript
const weaviate = require("weaviate-ts-client");
// Create a secret based on the API key
const apiKey = new weaviate.ApiKey("4jne...9me1");
// Create client objects
const client = weaviate.client({
scheme: 'https',
host: 'your-cluster.weaviate.network',
apiKey: apiKey,
});
// Run a command
result = client.misc
.metaGetter()
.do()
.then(res => {
console.log(res);
})
.catch(err => {
console.error(err)
});
console.log(result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment