@tsproxy/js
v0.2.0
Published
InstantSearch-compatible searchClient adapter for tsproxy
Maintainers
Readme
@tsproxy/js
InstantSearch-compatible searchClient adapter for tsproxy.
This project is in early release — APIs are stabilizing.
Install
npm install @tsproxy/jsUsage
import { createSearchClient } from "@tsproxy/js";
const searchClient = createSearchClient({
url: "http://localhost:3000",
locale: "en", // optional
cache: true, // optional (default: true)
});With react-instantsearch
import { InstantSearch } from "react-instantsearch";
import { createSearchClient } from "@tsproxy/js";
const searchClient = createSearchClient({ url: "http://localhost:3000" });
<InstantSearch searchClient={searchClient} indexName="products">
{/* widgets */}
</InstantSearch>Standalone
const results = await searchClient.search([
{ indexName: "products", params: { query: "keyboard", hitsPerPage: 10 } },
]);API
createSearchClient(options)
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| url | string | — | Proxy server URL (required) |
| locale | string | — | Locale for multilingual search |
| cache | boolean | true | Enable client-side result caching |
Documentation
License
MIT
