Skip to content

Commit

Permalink
add example
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenghaoz committed Nov 2, 2022
1 parent 4d7ef3b commit c0e915e
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,15 @@ Create a client by the entrypoint and api key.
```js
import { Gorse } from "gorsejs";

const client = new Gorse({
endpoint: "http://127.0.0.1:8087",
secret: "api_key",
});
const client = new Gorse({ endpoint: "http://127.0.0.1:8087", secret: "api_key" });

const reccomends = await client.getRecommend({userId: 'zhenghaoz'})
await client.insertFeedbacks([
{ FeedbackType: 'star', UserId: 'bob', ItemId: 'vuejs:vue', Timestamp: '2022-02-24' },
{ FeedbackType: 'star', UserId: 'bob', ItemId: 'd3:d3', Timestamp: '2022-02-25' },
{ FeedbackType: 'star', UserId: 'bob', ItemId: 'dogfalo:materialize', Timestamp: '2022-02-26' },
{ FeedbackType: 'star', UserId: 'bob', ItemId: 'mozilla:pdf.js', Timestamp: '2022-02-27' },
{ FeedbackType: 'star', UserId: 'bob', ItemId: 'moment:moment', Timestamp: '2022-02-28' }
]);

await client.getRecommend({ userId: 'bob', cursorOptions: { n: 10 } });
```

0 comments on commit c0e915e

Please sign in to comment.