-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: use
getPlatformProxy
and provide more context fields (#6)
- Loading branch information
1 parent
483955a
commit ec53843
Showing
6 changed files
with
149 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,18 @@ | ||
export default eventHandler(async () => { | ||
const { counter } = (await $fetch("/counter")) as { counter: number }; | ||
return `<div>Counter: ${counter}</div>`; | ||
export default eventHandler(async (event) => { | ||
const cloudflare = await event.context.cloudflare; | ||
|
||
const logs: string[] = []; | ||
const log = (str: string) => logs.push(str); | ||
|
||
log(`Keys of cloudflare: ${Object.keys(cloudflare).join(", ")}`); | ||
|
||
log(`Keys of cloudflare.env: ${Object.keys(cloudflare.env).join(", ")}`); | ||
|
||
log(`Colo: ${cloudflare.request.cf.colo}`); | ||
|
||
log( | ||
`typeof cloudflare.context.waitUntil: ${typeof cloudflare.context.waitUntil}`, | ||
); | ||
|
||
return `<div><ul><br>${logs.map((str) => `<li>${str}</li>`).join("\n<br>\n")}</ul></div>`; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,7 @@ | |
"prettier": "^3.2.4", | ||
"typescript": "^5.2.2", | ||
"unbuild": "^2.0.0", | ||
"wrangler": "^3.24.0" | ||
"wrangler": "^3.28.2" | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters