Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update middleware examples list #35622

Merged
merged 3 commits into from Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions docs/api-reference/next/server.md
Expand Up @@ -55,8 +55,6 @@ The `NextFetchEvent` object extends the native [`FetchEvent`](https://developer.

The `waitUntil()` method can be used to prolong the execution of the function, after the response has been sent. In practice this means that you can send a response, then continue the function execution if you have other background work to make.

An example of _why_ you would use `waitUntil()` is integrations with logging tools such as [Sentry](https://sentry.io) or [DataDog](https://www.datadoghq.com). After the response has been sent, you can send logs of response times, errors, API call durations or overall performance metrics.

Comment on lines -58 to -59
Copy link
Member Author

@lfades lfades Mar 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was removed because recommending it for these use cases is not ideal for the time being.

The `event` object is fully typed and can be imported from `next/server`.

```ts
Expand Down
2 changes: 0 additions & 2 deletions docs/middleware.md
Expand Up @@ -71,9 +71,7 @@ Middleware can be used for anything that shares logic for a set of pages, includ
- [Redirects and rewrites](https://github.com/vercel/examples/tree/main/edge-functions)
- [Handling unsupported browsers](https://github.com/vercel/examples/tree/main/edge-functions)
- [Feature flags and A/B tests](https://github.com/vercel/examples/tree/main/edge-functions)
- [Server-side analytics](https://github.com/vercel/examples/tree/main/edge-functions)
- [Advanced i18n routing requirements](https://github.com/vercel/examples/tree/main/edge-functions)
- [Logging](https://github.com/vercel/examples/tree/main/edge-functions)

## Execution Order

Expand Down