Sajari SDK for Node
The official Sajari Node client library.
Sajari is a smart, highly-configurable, real-time search service that enables thousands of businesses worldwide to provide amazing search experiences on their websites, stores, and applications.
Table of contents
Quickstart
Before you begin
- Create a Sajari account
- Retrieve your account credentials
Install the SDK
npm install @sajari/sdk-node
Use the SDK
The following example shows how to create a collection using the SDK.
⚠️ The function below cleans up after itself by deleting the collection immediately after creation.
import { CollectionsClient, withKeyCredentials } from "@sajari/sdk-node";
const client = new CollectionsClient(
withKeyCredentials("account-key-id", "account-key-secret")
);
async function createCollection(id, displayName) {
const collection = await client.createCollection({ id, displayName });
console.log(`Collection ${collection.displayName} created.`);
await client.deleteCollection(collection.id);
}
createCollection("collection-id", "Collection display name").catch(
console.error
);
Examples
Examples are in the examples directory.
Contributing
Contributions are welcome. See the Contributing guide.
License
MIT
See LICENSE