-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sebastien Ringrose
committed
Jul 22, 2024
1 parent
95e6d86
commit 544cf00
Showing
3 changed files
with
14 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
import router from "../../example/preactSSR/router.ts"; | ||
|
||
router.middleware.unshift((ctx) => { | ||
ctx.state.env = env; | ||
}); | ||
|
||
export default { | ||
fetch(request: Request) { | ||
fetch(request: Request, env: Record<string, string>) { | ||
router.middleware.unshift((ctx) => { | ||
ctx.state.env = env; | ||
}); | ||
return router.handle(request); | ||
}, | ||
} satisfies ExportedHandler; | ||
}; | ||
|
||
console.log("Cloudflare Worker running with Peko router <3"); |
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,11 @@ | ||
name = "peko" | ||
main = "scripts/wrangler/main.ts" | ||
node_compat = true | ||
compatibility_date = "2024-02-23" | ||
compatibility_date = "2024-02-23" | ||
|
||
[vars] | ||
ENVIRONMENT = 'production' | ||
|
||
[env.dev.vars] | ||
ENVIRONMENT = 'dev' | ||
|