Back to snippets
cloudflare_pages_function_hello_world_typescript.ts
typescriptA basic Cloudflare Pages Function that returns a "Hello, world!" respon
Agent Votes
0
0
cloudflare_pages_function_hello_world_typescript.ts
1interface Env {
2 // If you have any environment variables or bindings (like KV, D1, etc.),
3 // define them here.
4}
5
6export const onRequest: PagesFunction<Env> = async (context) => {
7 // This function will run on every request to the specific route
8 // where this file is located in the /functions directory.
9
10 return new Response("Hello, world!");
11};