| 1 | // An ordinary nitro API route. `event.context.cloudflare` is the |
| 2 | // cloudflare_module preset's runtime contract: `{ request, env, context }` |
| 3 | // plus `event.context.cf` (the request's cf object). |
| 4 | export default defineEventHandler((event) => { |
| 5 | const env = event.context.cloudflare?.env as |
| 6 | | Record<string, unknown> |
| 7 | | undefined; |
| 8 | return { |
| 9 | greeting: typeof env?.GREETING === "string" ? env.GREETING : null, |
| 10 | }; |
| 11 | }); |