Skip to content

Commit

Permalink
chore: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikstrasser committed Oct 28, 2024
1 parent c63b10c commit 8a77a71
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,26 +78,34 @@ export default {
After setting up the module you can use the `dcupl` instance in your Nuxt application:

```vue
<template>
<div>
{{ JSON.stringify(articles, null, 2) }}
</div>
</template>
<script setup lang="ts">
const dcupl = useDcupl()
const articleList = dcupl.lists.create({ modelKey: 'Article' })
articleList.catalog.query.applyOptions({ count: 10 })
const articles = ref([]);
const dcupl = useDcupl();
const articleList = dcupl.lists.create({ modelKey: "Article" });
articleList.catalog.query.applyOptions({ count: 10 });
// get initial data
articles.value = articleList.catalog.query.execute()
articles.value = articleList.catalog.query.execute();
</script>
```

Or in an API Endpoint:
Or in an API Endpoint (`server/api/test.ts`):

```ts
import { useDcuplServerInstance } from "#dcupl";

export default defineEventHandler(async (event) => {
const dcupl = await useDcuplServerInstance(event)
const dcupl = await useDcuplServerInstance(event);

const articleList = dcupl.lists.create({ modelKey: 'Article' })
articleList.catalog.query.applyOptions({ count: 10 })
return articleList.catalog.query.execute()
})
const articleList = dcupl.lists.create({ modelKey: "Article" });
articleList.catalog.query.applyOptions({ count: 10 });
return articleList.catalog.query.execute();
});
```

## Reload dcupl Server Session
Expand Down

0 comments on commit 8a77a71

Please sign in to comment.