Skip to content

Commit

Permalink
remove global from example
Browse files Browse the repository at this point in the history
  • Loading branch information
lubieowoce committed Dec 11, 2024
1 parent f946dea commit 8eb1e8e
Showing 1 changed file with 3 additions and 24 deletions.
27 changes: 3 additions & 24 deletions docs/01-app/02-building-your-application/10-deploying/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,11 @@ If you don't need a mix of both static and dynamic components, you can make your

`after` is fully supported in `next start`.

Note that when you want to stop the server, you should allow it to gracefully shutdown by sending `SIGINT`/`SIGTERM` and waiting. This will allow the server to wait for any pending callbacks/promises passed to `after` to finish.
Note that when you want to stop the server, you should allow it to gracefully shutdown by sending `SIGINT`/`SIGTERM` and waiting. This will allow the server to wait for any pending callbacks/promises passed to `after` to finish.

#### Serverless hosting

`after` is fully supported on Vercel. If you're using another serverless deployment platform, check if your provider supports `after`.
`after` is fully supported on Vercel. If you're using another serverless deployment platform, check if your provider supports `after`.

> **For platform providers**: see the [supporting `after` section](#for-providers-supporting-after-on-your-serverless-platform) for more information.
Expand Down Expand Up @@ -380,11 +380,7 @@ type NextRequestContextValue = {
}
```
### Examples
Depending on your requirements, this can be implemented in multiple ways.
#### Example: A wrapper around an [`AsyncLocalStorage`](https://nodejs.org/api/async_context.html#class-asynclocalstorage)
### Example
```tsx
import { AsyncLocalStorage } from 'node:async_hooks'
Expand All @@ -406,21 +402,4 @@ const handler = (req, res) => {
}
```
#### A global object
Note that this may not be appropriate depending on how concurrency is handled on your platform.
```tsx
const RequestContext: NextRequestContext = {
get() {
return { waitUntil: YOUR_WAITUNTIL }
},
}
globalThis[Symbol.for('@next/request-context')] = RequestContext

const handler = (req, res) => {
return nextJsHandler(req, res)
}
```
</AppOnly>

0 comments on commit 8eb1e8e

Please sign in to comment.