Skip to content

Commit 3a06bed

Browse files
committed
docs: update serve example
resolves #136
1 parent 516fb4a commit 3a06bed

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

docs/content/1.docs/2.storage/3.blob.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,21 @@ Returns [`BlobListResult`](#bloblistresult).
6161

6262
Returns a blob's data.
6363

64-
```ts [server/api/files/[...pathname\\].get.ts]
64+
65+
::code-group
66+
```ts [server/routes/images/[...pathname\\].get.ts]
6567
export default eventHandler(async (event) => {
6668
const { pathname } = getRouterParams(event)
6769

6870
return hubBlob().serve(event, pathname)
6971
})
7072
```
73+
```vue [pages/index.vue]
74+
<template>
75+
<img src="/images/my-image.jpg">
76+
</template>
77+
```
78+
::
7179

7280
#### Params
7381

@@ -84,14 +92,6 @@ export default eventHandler(async (event) => {
8492

8593
Returns the blob's raw data and sets `Content-Type` and `Content-Length` headers.
8694

87-
::callout{icon="i-heroicons-information-circle" class="prose-code:bg-gray-50 dark:prose-code:bg-gray-800"}
88-
If you are fetching an image with a server route similar to the one above, you might simply want to use it this way:
89-
<br>
90-
```vue
91-
<img :src="`/api/blob/${file.pathname}`">
92-
```
93-
::
94-
9595
### `head()`
9696

9797
Returns a blob's metadata.

0 commit comments

Comments
 (0)