Skip to content

Commit 284a67d

Browse files
authored
Update Next.js docs. (#7097)
1 parent 3e6321b commit 284a67d

File tree

1 file changed

+6
-40
lines changed

1 file changed

+6
-40
lines changed

content/pages/framework-guides/deploy-a-nextjs-site.md

Lines changed: 6 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,11 @@ filename: pages/api/hello.js
4343
// Next.js Edge API Routes: https://nextjs.org/docs/api-routes/edge-api-routes
4444

4545
export const config = {
46-
runtime: 'experimental-edge',
46+
runtime: 'edge',
4747
}
4848

4949
export default async function (req) {
50-
return new Response(
51-
JSON.stringify({ name: 'John Doe' }),
52-
{
53-
status: 200,
54-
headers: {
55-
'Content-Type': 'application/json'
56-
}
57-
}
58-
)
50+
return Response.json({ name: 'John Doe' })
5951
}
6052
```
6153

@@ -71,48 +63,22 @@ filename: pages/api/hello.ts
7163
import type { NextRequest } from 'next/server'
7264

7365
export const config = {
74-
runtime: 'experimental-edge',
66+
runtime: 'edge',
7567
}
7668

7769
export default async function (req: NextRequest) {
78-
return new Response(
79-
JSON.stringify({ name: 'John Doe' }),
80-
{
81-
status: 200,
82-
headers: {
83-
'Content-Type': 'application/json'
84-
}
85-
}
86-
)
70+
return Response.json({ name: 'John Doe' })
8771
}
8872
```
8973

9074
{{</tab>}}
9175
{{</tabs>}}
9276

93-
Next, you must configure the rest of the project to use the Edge Runtime. This can be done globally by adding the following to your `next.config.js` file:
94-
95-
```diff
96-
---
97-
filename: next.config.js
98-
---
99-
/** @type {import('next').NextConfig} */
100-
const nextConfig = {
101-
+ experimental: {
102-
+ runtime: 'experimental-edge',
103-
+ },
104-
reactStrictMode: true,
105-
swcMinify: true,
106-
}
107-
108-
module.exports = nextConfig
109-
```
110-
111-
Or you can opt in on individual pages by exporting the following from each page:
77+
Next, you must configure the rest of the project to use the Edge Runtime. You can opt in on individual pages by exporting the following from each page:
11278

11379
```js
11480
export const config = {
115-
runtime: "experimental-edge",
81+
runtime: "edge",
11682
};
11783
```
11884

0 commit comments

Comments
 (0)