Skip to content

Commit 0787320

Browse files
committed
feat(javascript): add onboarding snippet
1 parent da95580 commit 0787320

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { algoliasearch } from 'algoliasearch';
2+
3+
// Connect and authenticate with your Algolia app
4+
const client = algoliasearch('YourApplicationID', 'YourWriteAPIKey');
5+
6+
// Fetch and index objects in Algolia
7+
const processRecords = async () => {
8+
const datasetRequest = await fetch('https://dashboard.algolia.com/sample_datasets/movie.json');
9+
const objects = await datasetRequest.json();
10+
// return client.saveObjects({ indexName: 'movies_index', objects });
11+
};
12+
13+
processRecords()
14+
.then(() => console.log('Successfully indexed objects!'))
15+
.catch((err) => console.error(err));

0 commit comments

Comments
 (0)