Skip to content

Commit

Permalink
docs(serve-static/deno,bun): add onFound (#485)
Browse files Browse the repository at this point in the history
  • Loading branch information
yusukebe authored Sep 11, 2024
1 parent 72c9639 commit 8be179c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/getting-started/bun.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,22 @@ app.get(
)
```

### `onFound`

You can specify handling when the requested file is found with `onFound`:

```ts
app.get(
'/static/*',
serveStatic({
// ...
onFound: (_path, c) => {
c.header('Cache-Control', `public, immutable, max-age=31536000`)
},
})
)
```

### `onNotFound`

You can specify handling when the requested file is not found with `onNotFound`:
Expand Down
16 changes: 16 additions & 0 deletions docs/getting-started/deno.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,22 @@ app.get(
)
```

### `onFound`

You can specify handling when the requested file is found with `onFound`:

```ts
app.get(
'/static/*',
serveStatic({
// ...
onFound: (_path, c) => {
c.header('Cache-Control', `public, immutable, max-age=31536000`)
},
})
)
```

### `onNotFound`

You can specify handling when the requested file is not found with `onNotFound`:
Expand Down

0 comments on commit 8be179c

Please sign in to comment.