Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit fa2e1ac

Browse files
committed
chore: update examples
1 parent e5505ba commit fa2e1ac

File tree

4 files changed

+6
-14
lines changed

4 files changed

+6
-14
lines changed

examples/hello-world-spa/api/counter/[action].ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const store = globalThis as any
55
export default async function handler(req: APIRequest) {
66
let count = store.$count || 0
77

8-
switch (req.params.action) {
8+
switch (req.params.get('action')) {
99
case 'increase':
1010
count++
1111
store.$count = count
@@ -20,7 +20,7 @@ export default async function handler(req: APIRequest) {
2020
req.status(400).json({
2121
error: 'UnknownAction',
2222
status: 400,
23-
message: `undefined action '${req.params.action}'`
23+
message: `undefined action '${req.params.get('action')}'`
2424
})
2525
break
2626
}

examples/hello-world-src-dir/src/api/counter/[action].ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const store = globalThis as any
55
export default async function handler(req: APIRequest) {
66
let count = store.$count || 0
77

8-
switch (req.params.action) {
8+
switch (req.params.get('action')) {
99
case 'increase':
1010
count++
1111
store.$count = count
@@ -20,7 +20,7 @@ export default async function handler(req: APIRequest) {
2020
req.status(400).json({
2121
error: 'UnknownAction',
2222
status: 400,
23-
message: `undefined action '${req.params.action}'`
23+
message: `undefined action '${req.params.get('action')}'`
2424
})
2525
break
2626
}

examples/hello-world/api/counter/[action].ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const store = globalThis as any
55
export default async function handler(req: APIRequest) {
66
let count = store.$count || 0
77

8-
switch (req.params.action) {
8+
switch (req.params.get('action')) {
99
case 'increase':
1010
count++
1111
store.$count = count
@@ -20,7 +20,7 @@ export default async function handler(req: APIRequest) {
2020
req.status(400).json({
2121
error: 'UnknownAction',
2222
status: 400,
23-
message: `undefined action '${req.params.action}'`
23+
message: `undefined action '${req.params.get('action')}'`
2424
})
2525
break
2626
}

examples/hello-world/api/user.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)