File tree Expand file tree Collapse file tree 8 files changed +131
-6
lines changed Expand file tree Collapse file tree 8 files changed +131
-6
lines changed Original file line number Diff line number Diff line change 1+ # Browser demo
2+
3+ ## Requirements
4+
5+ Build the base project ` /meilisearch-js ` as this example uses the locally build bundles from ` meilisearch-js ` .
6+
7+ ```
8+ $ cd meilisearch-js
9+ $ yarn build
10+ ```
11+
12+ ## Credentials
13+
14+ This example uses the following MeiliSearch address: ` http://127.0.0.1:7700 ` . Feel free to change the credentials to meet your MeiliSearch address.
15+
16+ The credentials are written in ` index.html ` .
17+
18+ ## Try out
19+
20+ To try out this html file, just open it using any browser.
Original file line number Diff line number Diff line change 77 < meta name ='viewport ' content ='width=device-width, initial-scale=1 '>
88</ head >
99< body >
10- hello
10+ Indexes:
11+ < div id ="indexes "> </ div >
1112</ body >
1213</ html >
13- < script src ="../../dist/bundles/meilisearch.umd .js "> </ script >
14+ < script src ="../../dist/bundles/meilisearch.browser .js "> </ script >
1415< script >
15- const client = new window . Meiliearch ( {
16+ const client = new window . MeiliSearch ( {
1617 host : 'http://127.0.0.1:7700' ,
1718 apiKey : 'masterKey' ,
1819 } )
1920 client . listIndexes ( ) . then ( res => {
2021 console . log ( { res } ) ;
22+ res . map ( index => document . querySelector ( '#indexes' ) . innerHTML = `<div>${ index . name } </div>` )
2123 } )
2224</ script >
Original file line number Diff line number Diff line change 1+ # Node demo
2+
3+ ## Requirements
4+
5+ Build the base project ` /meilisearch-js ` as this example uses the locally build bundles from ` meilisearch-js ` .
6+
7+ ```
8+ $ cd meilisearch-js
9+ $ yarn build
10+ ```
11+
12+ ## Credentials
13+
14+ This example uses the following MeiliSearch address: ` http://127.0.0.1:7700 ` . Feel free to change the credentials to meet your MeiliSearch address.
15+
16+ The credentials are written in each script.
17+
18+ ## Try out
19+
20+ To try it out you just need to execute the script that you want to try out.
21+
22+ For example:
23+ ```
24+ node search_example.js
25+ ```
Original file line number Diff line number Diff line change 1- const MeiliSearch = require ( '../../' )
1+ const MeiliSearch = require ( '../../dist/bundles/meilisearch.cjs.js ' )
22const dataset = require ( './small_movies.json' )
33
44const config = {
Original file line number Diff line number Diff line change 1- const MeiliSearch = require ( '../../' )
1+ const MeiliSearch = require ( '../../dist/bundles/meilisearch.cjs.js ' )
22
33const config = {
44 host : 'http://127.0.0.1:7700' ,
Original file line number Diff line number Diff line change 1+ # TypeScript React demo
2+
3+ ## Requirements
4+
5+ Build the base project ` /meilisearch-js ` as this example uses the locally build bundles from ` meilisearch-js ` .
6+
7+ ```
8+ $ cd meilisearch-js
9+ $ yarn build
10+ ```
11+
12+ ## Credentials
13+
14+ This example uses the following MeiliSearch address: ` http://127.0.0.1:7700 ` . Feel free to change the credentials to meet your MeiliSearch address.
15+
16+ The credentials are written in ` src/index.ts ` .
17+
18+ ## Try out
19+
20+ To try it out you need to follow these steps.
21+
22+ ### 1. Install dependencies
23+
24+ ``` bash
25+ $ yarn
26+ ```
27+
28+ ### 2. Build
29+
30+ ``` bash
31+ $ yarn build
32+ ```
33+
34+ ### 3. Serve
35+
36+ ``` bash
37+ $ http-server public
38+ ```
39+
40+ We used http-server CLI to serve the webpage. Feel free to use any tool with the same purpose as it will not impact the result.
Original file line number Diff line number Diff line change @@ -18,5 +18,5 @@ function greeter(person: string) {
1818 const uids = indexes . map ( ( index : IndexResponse ) => index . uid )
1919 document . body . innerHTML = `${ greeter (
2020 user
21- ) } this is the list of all your indexes: ${ uids . join ( ', ' ) } `
21+ ) } this is the list of all your indexes: \n ${ uids . join ( ', ' ) } `
2222} ) ( )
Original file line number Diff line number Diff line change 1+ # TypeScript Node demo
2+
3+ ## Requirements
4+
5+ Build the base project ` /meilisearch-js ` as this example uses the locally build bundles from ` meilisearch-js ` .
6+
7+ ```
8+ $ cd meilisearch-js
9+ $ yarn build
10+ ```
11+
12+ ## Credentials
13+
14+ This example uses the following MeiliSearch address: ` http://127.0.0.1:7700 ` . Feel free to change the credentials to meet your MeiliSearch address.
15+
16+ The credentials are written in ` src/index.ts ` .
17+
18+ ## Try out
19+
20+ To try it out you need to follow these steps:
21+
22+ ### 1. Install dependencies
23+
24+ ``` bash
25+ $ yarn
26+ ```
27+
28+ ### 2. Build
29+
30+ ``` bash
31+ $ yarn build
32+ ```
33+
34+ ### 3. Execute
35+
36+ ``` bash
37+ $ node build/bundle.js
38+ ```
You can’t perform that action at this time.
0 commit comments