[{"data":1,"prerenderedAt":2137},["ShallowReactive",2],{"navigation":3,"-deploy-providers-cloudflare":402,"-deploy-providers-cloudflare-surround":2132},[4,93,226,232,387,399],{"title":5,"path":6,"stem":7,"children":8,"icon":92},"","\u002Fdocs","1.docs\u002F1.index",[9,12,17,22,27,32,37,42,47,52,57,62,67,72,77,82,87],{"title":10,"path":6,"stem":7,"icon":11},"Introduction","i-lucide-compass",{"title":13,"path":14,"stem":15,"icon":16},"Quick Start","\u002Fdocs\u002Fquick-start","1.docs\u002F2.quick-start","i-lucide-zap",{"title":18,"path":19,"stem":20,"icon":21},"Renderer","\u002Fdocs\u002Frenderer","1.docs\u002F4.renderer","ri:layout-masonry-line",{"title":23,"path":24,"stem":25,"icon":26},"Routing","\u002Fdocs\u002Frouting","1.docs\u002F5.routing","ri:direction-line",{"title":28,"path":29,"stem":30,"icon":31},"Assets","\u002Fdocs\u002Fassets","1.docs\u002F50.assets","ri:image-2-line",{"title":33,"path":34,"stem":35,"icon":36},"Configuration","\u002Fdocs\u002Fconfiguration","1.docs\u002F50.configuration","ri:settings-3-line",{"title":38,"path":39,"stem":40,"icon":41},"Database","\u002Fdocs\u002Fdatabase","1.docs\u002F50.database","ri:database-2-line",{"title":43,"path":44,"stem":45,"icon":46},"Lifecycle","\u002Fdocs\u002Flifecycle","1.docs\u002F50.lifecycle","i-lucide-layers",{"title":48,"path":49,"stem":50,"icon":51},"OpenAPI","\u002Fdocs\u002Fopenapi","1.docs\u002F50.openapi","ri:contract-line",{"title":53,"path":54,"stem":55,"icon":56},"Plugins","\u002Fdocs\u002Fplugins","1.docs\u002F50.plugins","ri:plug-line",{"title":58,"path":59,"stem":60,"icon":61},"Tasks","\u002Fdocs\u002Ftasks","1.docs\u002F50.tasks","codicon:run-all",{"title":63,"path":64,"stem":65,"icon":66},"WebSocket","\u002Fdocs\u002Fwebsocket","1.docs\u002F50.websocket","ri:broadcast-fill",{"title":68,"path":69,"stem":70,"icon":71},"Server Entry","\u002Fdocs\u002Fserver-entry","1.docs\u002F6.server-entry","ri:server-line",{"title":73,"path":74,"stem":75,"icon":76},"Cache","\u002Fdocs\u002Fcache","1.docs\u002F7.cache","ri:speed-line",{"title":78,"path":79,"stem":80,"icon":81},"KV Storage","\u002Fdocs\u002Fstorage","1.docs\u002F8.storage","carbon:datastore",{"title":83,"path":84,"stem":85,"icon":86},"Migration Guide","\u002Fdocs\u002Fmigration","1.docs\u002F99.migration","ri:arrow-right-up-line",{"title":88,"path":89,"stem":90,"icon":91},"Nightly Channel","\u002Fdocs\u002Fnightly","1.docs\u002F99.nightly","ri:moon-fill","i-lucide-book-open",{"title":94,"path":95,"stem":96,"children":97,"icon":99},"Deploy","\u002Fdeploy","2.deploy\u002F0.index",[98,100,121],{"title":94,"path":95,"stem":96,"icon":99},"ri:upload-cloud-2-line",{"title":101,"path":102,"stem":103,"children":104,"page":120},"Runtimes","\u002Fdeploy\u002Fruntimes","2.deploy\u002F10.runtimes",[105,110,115],{"title":106,"path":107,"stem":108,"icon":109},"Node.js","\u002Fdeploy\u002Fruntimes\u002Fnode","2.deploy\u002F10.runtimes\u002F1.node","akar-icons:node-fill",{"title":111,"path":112,"stem":113,"icon":114},"Bun","\u002Fdeploy\u002Fruntimes\u002Fbun","2.deploy\u002F10.runtimes\u002Fbun","simple-icons:bun",{"title":116,"path":117,"stem":118,"icon":119},"Deno","\u002Fdeploy\u002Fruntimes\u002Fdeno","2.deploy\u002F10.runtimes\u002Fdeno","simple-icons:deno",false,{"title":122,"path":123,"stem":124,"children":125,"page":120},"Providers","\u002Fdeploy\u002Fproviders","2.deploy\u002F20.providers",[126,130,134,138,142,146,150,154,158,162,166,170,174,178,182,186,190,194,198,202,206,210,214,218,222],{"title":127,"path":128,"stem":129},"Alwaysdata","\u002Fdeploy\u002Fproviders\u002Falwaysdata","2.deploy\u002F20.providers\u002Falwaysdata",{"title":131,"path":132,"stem":133},"AWS Lambda","\u002Fdeploy\u002Fproviders\u002Faws","2.deploy\u002F20.providers\u002Faws",{"title":135,"path":136,"stem":137},"AWS Amplify","\u002Fdeploy\u002Fproviders\u002Faws-amplify","2.deploy\u002F20.providers\u002Faws-amplify",{"title":139,"path":140,"stem":141},"Azure","\u002Fdeploy\u002Fproviders\u002Fazure","2.deploy\u002F20.providers\u002Fazure",{"title":143,"path":144,"stem":145},"Cleavr","\u002Fdeploy\u002Fproviders\u002Fcleavr","2.deploy\u002F20.providers\u002Fcleavr",{"title":147,"path":148,"stem":149},"Cloudflare","\u002Fdeploy\u002Fproviders\u002Fcloudflare","2.deploy\u002F20.providers\u002Fcloudflare",{"title":151,"path":152,"stem":153},"Deno Deploy","\u002Fdeploy\u002Fproviders\u002Fdeno-deploy","2.deploy\u002F20.providers\u002Fdeno-deploy",{"title":155,"path":156,"stem":157},"DigitalOcean","\u002Fdeploy\u002Fproviders\u002Fdigitalocean","2.deploy\u002F20.providers\u002Fdigitalocean",{"title":159,"path":160,"stem":161},"EdgeOne Pages","\u002Fdeploy\u002Fproviders\u002Fedgeone","2.deploy\u002F20.providers\u002Fedgeone",{"title":163,"path":164,"stem":165},"Firebase","\u002Fdeploy\u002Fproviders\u002Ffirebase","2.deploy\u002F20.providers\u002Ffirebase",{"title":167,"path":168,"stem":169},"Flightcontrol","\u002Fdeploy\u002Fproviders\u002Fflightcontrol","2.deploy\u002F20.providers\u002Fflightcontrol",{"title":171,"path":172,"stem":173},"Genezio","\u002Fdeploy\u002Fproviders\u002Fgenezio","2.deploy\u002F20.providers\u002Fgenezio",{"title":175,"path":176,"stem":177},"GitHub Pages","\u002Fdeploy\u002Fproviders\u002Fgithub-pages","2.deploy\u002F20.providers\u002Fgithub-pages",{"title":179,"path":180,"stem":181},"GitLab Pages","\u002Fdeploy\u002Fproviders\u002Fgitlab-pages","2.deploy\u002F20.providers\u002Fgitlab-pages",{"title":183,"path":184,"stem":185},"Heroku","\u002Fdeploy\u002Fproviders\u002Fheroku","2.deploy\u002F20.providers\u002Fheroku",{"title":187,"path":188,"stem":189},"IIS","\u002Fdeploy\u002Fproviders\u002Fiis","2.deploy\u002F20.providers\u002Fiis",{"title":191,"path":192,"stem":193},"Koyeb","\u002Fdeploy\u002Fproviders\u002Fkoyeb","2.deploy\u002F20.providers\u002Fkoyeb",{"title":195,"path":196,"stem":197},"Netlify","\u002Fdeploy\u002Fproviders\u002Fnetlify","2.deploy\u002F20.providers\u002Fnetlify",{"title":199,"path":200,"stem":201},"Platform.sh","\u002Fdeploy\u002Fproviders\u002Fplatform-sh","2.deploy\u002F20.providers\u002Fplatform-sh",{"title":203,"path":204,"stem":205},"Render.com","\u002Fdeploy\u002Fproviders\u002Frender","2.deploy\u002F20.providers\u002Frender",{"title":207,"path":208,"stem":209},"StormKit","\u002Fdeploy\u002Fproviders\u002Fstormkit","2.deploy\u002F20.providers\u002Fstormkit",{"title":211,"path":212,"stem":213},"Vercel","\u002Fdeploy\u002Fproviders\u002Fvercel","2.deploy\u002F20.providers\u002Fvercel",{"title":215,"path":216,"stem":217},"Zeabur","\u002Fdeploy\u002Fproviders\u002Fzeabur","2.deploy\u002F20.providers\u002Fzeabur",{"title":219,"path":220,"stem":221},"Zephyr Cloud","\u002Fdeploy\u002Fproviders\u002Fzephyr","2.deploy\u002F20.providers\u002Fzephyr",{"title":223,"path":224,"stem":225},"Zerops","\u002Fdeploy\u002Fproviders\u002Fzerops","2.deploy\u002F20.providers\u002Fzerops",{"title":227,"path":228,"stem":229,"children":230,"icon":36},"Config","\u002Fconfig","3.config\u002F0.index",[231],{"title":227,"path":228,"stem":229,"icon":36},{"title":233,"path":234,"stem":235,"children":236,"icon":238},"Examples","\u002Fexamples","4.examples\u002F0.index",[237,239,244,249,254,259,263,268,273,278,283,288,293,297,302,306,310,315,320,325,330,335,340,345,350,355,359,364,369,373,378,383],{"title":233,"path":234,"stem":235,"icon":238},"i-lucide-folder-code",{"title":240,"path":241,"stem":242,"icon":243},"API Routes","\u002Fexamples\u002Fapi-routes","4.examples\u002Fapi-routes","i-lucide-route",{"title":245,"path":246,"stem":247,"icon":248},"Auto Imports","\u002Fexamples\u002Fauto-imports","4.examples\u002Fauto-imports","i-lucide-import",{"title":250,"path":251,"stem":252,"icon":253},"Cached Handler","\u002Fexamples\u002Fcached-handler","4.examples\u002Fcached-handler","i-lucide-clock",{"title":255,"path":256,"stem":257,"icon":258},"Custom Error Handler","\u002Fexamples\u002Fcustom-error-handler","4.examples\u002Fcustom-error-handler","i-lucide-alert-circle",{"title":38,"path":260,"stem":261,"icon":262},"\u002Fexamples\u002Fdatabase","4.examples\u002Fdatabase","i-lucide-database",{"title":264,"path":265,"stem":266,"icon":267},"Elysia","\u002Fexamples\u002Felysia","4.examples\u002Felysia","i-skill-icons-elysia-dark",{"title":269,"path":270,"stem":271,"icon":272},"Express","\u002Fexamples\u002Fexpress","4.examples\u002Fexpress","i-simple-icons-express",{"title":274,"path":275,"stem":276,"icon":277},"Fastify","\u002Fexamples\u002Ffastify","4.examples\u002Ffastify","i-simple-icons-fastify",{"title":279,"path":280,"stem":281,"icon":282},"Hello World","\u002Fexamples\u002Fhello-world","4.examples\u002Fhello-world","i-lucide-sparkles",{"title":284,"path":285,"stem":286,"icon":287},"Hono","\u002Fexamples\u002Fhono","4.examples\u002Fhono","i-logos-hono",{"title":289,"path":290,"stem":291,"icon":292},"Import Alias","\u002Fexamples\u002Fimport-alias","4.examples\u002Fimport-alias","i-lucide-at-sign",{"title":294,"path":295,"stem":296,"icon":46},"Middleware","\u002Fexamples\u002Fmiddleware","4.examples\u002Fmiddleware",{"title":298,"path":299,"stem":300,"icon":301},"Mono JSX","\u002Fexamples\u002Fmono-jsx","4.examples\u002Fmono-jsx","i-lucide-brackets",{"title":303,"path":304,"stem":305,"icon":301},"Nano JSX","\u002Fexamples\u002Fnano-jsx","4.examples\u002Fnano-jsx",{"title":53,"path":307,"stem":308,"icon":309},"\u002Fexamples\u002Fplugins","4.examples\u002Fplugins","i-lucide-plug",{"title":311,"path":312,"stem":313,"icon":314},"Custom Renderer","\u002Fexamples\u002Frenderer","4.examples\u002Frenderer","i-lucide-code",{"title":316,"path":317,"stem":318,"icon":319},"Runtime Config","\u002Fexamples\u002Fruntime-config","4.examples\u002Fruntime-config","i-lucide-settings",{"title":321,"path":322,"stem":323,"icon":324},"Server Fetch","\u002Fexamples\u002Fserver-fetch","4.examples\u002Fserver-fetch","i-lucide-arrow-right-left",{"title":326,"path":327,"stem":328,"icon":329},"Shiki","\u002Fexamples\u002Fshiki","4.examples\u002Fshiki","i-lucide-highlighter",{"title":331,"path":332,"stem":333,"icon":334},"Virtual Routes","\u002Fexamples\u002Fvirtual-routes","4.examples\u002Fvirtual-routes","i-lucide-box",{"title":336,"path":337,"stem":338,"icon":339},"Vite Nitro Plugin","\u002Fexamples\u002Fvite-nitro-plugin","4.examples\u002Fvite-nitro-plugin","i-logos-vitejs",{"title":341,"path":342,"stem":343,"icon":344},"Vite RSC","\u002Fexamples\u002Fvite-rsc","4.examples\u002Fvite-rsc","i-logos-react",{"title":346,"path":347,"stem":348,"icon":349},"Vite SSR HTML","\u002Fexamples\u002Fvite-ssr-html","4.examples\u002Fvite-ssr-html","i-logos-html-5",{"title":351,"path":352,"stem":353,"icon":354},"SSR with Preact","\u002Fexamples\u002Fvite-ssr-preact","4.examples\u002Fvite-ssr-preact","i-logos-preact",{"title":356,"path":357,"stem":358,"icon":344},"SSR with React","\u002Fexamples\u002Fvite-ssr-react","4.examples\u002Fvite-ssr-react",{"title":360,"path":361,"stem":362,"icon":363},"SSR with SolidJS","\u002Fexamples\u002Fvite-ssr-solid","4.examples\u002Fvite-ssr-solid","i-logos-solidjs-icon",{"title":365,"path":366,"stem":367,"icon":368},"SSR with TanStack Router","\u002Fexamples\u002Fvite-ssr-tsr-react","4.examples\u002Fvite-ssr-tsr-react","i-simple-icons-tanstack",{"title":370,"path":371,"stem":372,"icon":368},"SSR with TanStack Start","\u002Fexamples\u002Fvite-ssr-tss-react","4.examples\u002Fvite-ssr-tss-react",{"title":374,"path":375,"stem":376,"icon":377},"SSR with Vue Router","\u002Fexamples\u002Fvite-ssr-vue-router","4.examples\u002Fvite-ssr-vue-router","i-logos-vue",{"title":379,"path":380,"stem":381,"icon":382},"Vite + tRPC","\u002Fexamples\u002Fvite-trpc","4.examples\u002Fvite-trpc","i-simple-icons-trpc",{"title":63,"path":384,"stem":385,"icon":386},"\u002Fexamples\u002Fwebsocket","4.examples\u002Fwebsocket","i-lucide-radio",{"title":388,"path":389,"stem":390,"children":391},"Blog","\u002Fblog","9.blog",[392,395],{"title":388,"path":389,"stem":393,"icon":394},"9.blog\u002Findex","i-lucide-file-text",{"title":396,"path":397,"stem":398,"icon":394},"Nitro v3 Beta is here!","\u002Fblog\u002Fv3-beta","9.blog\u002F1.v3-beta",{"title":5,"path":400,"stem":401},"\u002F","index",{"id":403,"title":147,"body":404,"description":2126,"extension":2127,"meta":2128,"navigation":2129,"path":148,"seo":2130,"stem":149,"__hash__":2131},"content\u002F2.deploy\u002F20.providers\u002Fcloudflare.md",{"type":405,"value":406,"toc":2102},"minimark",[407,412,424,428,447,457,464,580,603,622,627,636,640,644,648,651,654,657,660,663,667,679,681,724,728,735,810,813,822,831,867,871,888,1008,1011,1015,1022,1025,1031,1041,1046,1113,1130,1133,1138,1140,1143,1146,1149,1151,1153,1156,1160,1169,1185,1189,1200,1209,1223,1352,1356,1366,1392,1408,1412,1435,1446,1456,1460,1471,1480,1488,1493,1497,1668,1672,1686,1700,1711,1714,1716,1723,1843,1847,1858,1863,1995,2002,2006,2009,2012,2021,2026,2029,2098],[408,409,411],"h2",{"id":410},"cloudflare-workers","Cloudflare Workers",[413,414,415,419,420],"p",{},[416,417,418],"strong",{},"Preset:"," ",[421,422,423],"code",{},"cloudflare_module",[425,426],"read-more",{"to":427,"title":411},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002F",[429,430,431],"note",{},[413,432,433,434,439,440,446],{},"Integration with this provider is possible with ",[435,436,438],"a",{"href":437},"\u002Fdeploy#zero-config-providers","zero configuration"," supporting ",[435,441,445],{"href":442,"rel":443},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002Fci-cd\u002Fbuilds\u002F",[444],"nofollow","workers builds (beta)",".",[448,449,450],"important",{},[413,451,452,453,456],{},"To use Workers with Static Assets, you need a Nitro compatibility date set to ",[421,454,455],{},"2024-09-19"," or later.",[413,458,459,460,463],{},"The following shows an example ",[421,461,462],{},"nitro.config.ts"," file for deploying a Nitro app to Cloudflare Workers.",[465,466,470],"pre",{"className":467,"code":468,"filename":462,"language":469,"meta":5,"style":5},"language-ts shiki shiki-themes github-light github-dark github-dark","import { defineConfig } from \"nitro\";\n\nexport default defineConfig({\n    compatibilityDate: \"2024-09-19\",\n    preset: \"cloudflare_module\",\n    cloudflare: {\n      deployConfig: true,\n      nodeCompat: true\n    }\n})\n","ts",[421,471,472,495,502,518,530,541,547,559,568,574],{"__ignoreMap":5},[473,474,477,481,485,488,492],"span",{"class":475,"line":476},"line",1,[473,478,480],{"class":479},"so5gQ","import",[473,482,484],{"class":483},"slsVL"," { defineConfig } ",[473,486,487],{"class":479},"from",[473,489,491],{"class":490},"sfrk1"," \"nitro\"",[473,493,494],{"class":483},";\n",[473,496,498],{"class":475,"line":497},2,[473,499,501],{"emptyLinePlaceholder":500},true,"\n",[473,503,505,508,511,515],{"class":475,"line":504},3,[473,506,507],{"class":479},"export",[473,509,510],{"class":479}," default",[473,512,514],{"class":513},"shcOC"," defineConfig",[473,516,517],{"class":483},"({\n",[473,519,521,524,527],{"class":475,"line":520},4,[473,522,523],{"class":483},"    compatibilityDate: ",[473,525,526],{"class":490},"\"2024-09-19\"",[473,528,529],{"class":483},",\n",[473,531,533,536,539],{"class":475,"line":532},5,[473,534,535],{"class":483},"    preset: ",[473,537,538],{"class":490},"\"cloudflare_module\"",[473,540,529],{"class":483},[473,542,544],{"class":475,"line":543},6,[473,545,546],{"class":483},"    cloudflare: {\n",[473,548,550,553,557],{"class":475,"line":549},7,[473,551,552],{"class":483},"      deployConfig: ",[473,554,556],{"class":555},"suiK_","true",[473,558,529],{"class":483},[473,560,562,565],{"class":475,"line":561},8,[473,563,564],{"class":483},"      nodeCompat: ",[473,566,567],{"class":555},"true\n",[473,569,571],{"class":475,"line":570},9,[473,572,573],{"class":483},"    }\n",[473,575,577],{"class":475,"line":576},10,[473,578,579],{"class":483},"})\n",[413,581,582,583,586,587,590,591,596,597,602],{},"By setting ",[421,584,585],{},"deployConfig: true",", Nitro will automatically generate a ",[421,588,589],{},"wrangler.json"," for you with the correct configuration.\nIf you need to add ",[435,592,595],{"href":593,"rel":594},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002Fwrangler\u002Fconfiguration\u002F",[444],"Cloudflare Workers configuration",", such as ",[435,598,601],{"href":599,"rel":600},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002Fruntime-apis\u002Fbindings\u002F",[444],"bindings",", you can either:",[604,605,606,616],"ul",{},[607,608,609,610,613,614,446],"li",{},"Set these in your Nitro config under the ",[421,611,612],{},"cloudflare: { wrangler : {} }",". This has the same type as ",[421,615,589],{},[607,617,618,619,621],{},"Provide your own ",[421,620,589],{},". Nitro will merge your config with the appropriate settings, including pointing to the build output.",[623,624,626],"h3",{"id":625},"local-preview","Local Preview",[413,628,629,630,635],{},"You can use ",[435,631,634],{"href":632,"rel":633},"https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fworkers-sdk\u002Ftree\u002Fmain\u002Fpackages\u002Fwrangler",[444],"Wrangler"," to preview your app locally:",[637,638],"pm-run",{"script":639},"build",[641,642],"pm-x",{"command":643},"wrangler dev",[623,645,647],{"id":646},"manual-deploy","Manual Deploy",[413,649,650],{},"After having built your application you can manually deploy it with Wrangler.",[413,652,653],{},"First make sure to be logged into your Cloudflare account:",[641,655],{"command":656},"wrangler login",[413,658,659],{},"Then you can deploy the application with:",[641,661],{"command":662},"wrangler deploy",[623,664,666],{"id":665},"runtime-hooks","Runtime Hooks",[413,668,629,669,673,674,446],{},[435,670,672],{"href":671},"\u002Fdocs\u002Fplugins#nitro-runtime-hooks","runtime hooks"," below in order to extend ",[435,675,678],{"href":676,"rel":677},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002Fruntime-apis\u002Fhandlers\u002F",[444],"Worker handlers",[425,680],{"to":671},[604,682,683,692,701,710,719],{},[607,684,685],{},[435,686,689],{"href":687,"rel":688},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002Fruntime-apis\u002Fhandlers\u002Fscheduled\u002F",[444],[421,690,691],{},"cloudflare:scheduled",[607,693,694],{},[435,695,698],{"href":696,"rel":697},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Femail-routing\u002Femail-workers\u002Fruntime-api\u002F",[444],[421,699,700],{},"cloudflare:email",[607,702,703],{},[435,704,707],{"href":705,"rel":706},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fqueues\u002Fconfiguration\u002Fjavascript-apis\u002F#consumer",[444],[421,708,709],{},"cloudflare:queue",[607,711,712],{},[435,713,716],{"href":714,"rel":715},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002Fruntime-apis\u002Fhandlers\u002Ftail\u002F",[444],[421,717,718],{},"cloudflare:tail",[607,720,721],{},[421,722,723],{},"cloudflare:trace",[623,725,727],{"id":726},"additional-exports","Additional Exports",[413,729,730,731,734],{},"You can add a ",[421,732,733],{},"exports.cloudflare.ts"," file to your project root to export additional handlers or properties to the Cloudflare Worker entrypoint.",[465,736,738],{"className":467,"code":737,"filename":733,"language":469,"meta":5,"style":5},"export class MyWorkflow extends WorkflowEntrypoint {\n  async run(event: WorkflowEvent, step: WorkflowStep) {\n    \u002F\u002F ...\n  }\n}\n",[421,739,740,759,794,800,805],{"__ignoreMap":5},[473,741,742,744,747,750,753,756],{"class":475,"line":476},[473,743,507],{"class":479},[473,745,746],{"class":479}," class",[473,748,749],{"class":513}," MyWorkflow",[473,751,752],{"class":479}," extends",[473,754,755],{"class":513}," WorkflowEntrypoint",[473,757,758],{"class":483}," {\n",[473,760,761,764,767,770,774,777,780,783,786,788,791],{"class":475,"line":497},[473,762,763],{"class":479},"  async",[473,765,766],{"class":513}," run",[473,768,769],{"class":483},"(",[473,771,773],{"class":772},"sQHwn","event",[473,775,776],{"class":479},":",[473,778,779],{"class":513}," WorkflowEvent",[473,781,782],{"class":483},", ",[473,784,785],{"class":772},"step",[473,787,776],{"class":479},[473,789,790],{"class":513}," WorkflowStep",[473,792,793],{"class":483},") {\n",[473,795,796],{"class":475,"line":504},[473,797,799],{"class":798},"sCsY4","    \u002F\u002F ...\n",[473,801,802],{"class":475,"line":520},[473,803,804],{"class":483},"  }\n",[473,806,807],{"class":475,"line":532},[473,808,809],{"class":483},"}\n",[413,811,812],{},"Nitro will automatically detect this file and include its exports in the final build.",[814,815,816],"warning",{},[413,817,818,819,821],{},"The ",[421,820,733],{}," file must not have a default export.",[413,823,824,825,828,829,776],{},"You can also customize the entrypoint file location using the ",[421,826,827],{},"cloudflare.exports"," option in your ",[421,830,462],{},[465,832,834],{"className":467,"code":833,"filename":462,"language":469,"meta":5,"style":5},"export default defineConfig({\n  cloudflare: {\n    exports: \"custom-exports-entry.ts\"\n  }\n})\n",[421,835,836,846,851,859,863],{"__ignoreMap":5},[473,837,838,840,842,844],{"class":475,"line":476},[473,839,507],{"class":479},[473,841,510],{"class":479},[473,843,514],{"class":513},[473,845,517],{"class":483},[473,847,848],{"class":475,"line":497},[473,849,850],{"class":483},"  cloudflare: {\n",[473,852,853,856],{"class":475,"line":504},[473,854,855],{"class":483},"    exports: ",[473,857,858],{"class":490},"\"custom-exports-entry.ts\"\n",[473,860,861],{"class":475,"line":520},[473,862,804],{"class":483},[473,864,865],{"class":475,"line":532},[473,866,579],{"class":483},[623,868,870],{"id":869},"scheduled-tasks-cron-triggers","Scheduled Tasks (Cron Triggers)",[413,872,873,874,877,878,881,882,887],{},"When using ",[435,875,876],{"href":59},"Nitro tasks"," with ",[421,879,880],{},"scheduledTasks",", Nitro automatically generates ",[435,883,886],{"href":884,"rel":885},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002Fconfiguration\u002Fcron-triggers\u002F",[444],"Cron Triggers"," in the wrangler config at build time.",[465,889,891],{"className":467,"code":890,"filename":462,"language":469,"meta":5,"style":5},"import { defineConfig } from \"nitro\";\n\nexport default defineConfig({\n  preset: \"cloudflare_module\",\n  experimental: {\n    tasks: true,\n  },\n  scheduledTasks: {\n    \"* * * * *\": [\"cms:update\"],\n    \"0 15 1 * *\": [\"db:cleanup\"],\n  },\n  cloudflare: {\n    deployConfig: true,\n  },\n})\n",[421,892,893,905,909,919,928,933,942,947,952,966,978,983,988,998,1003],{"__ignoreMap":5},[473,894,895,897,899,901,903],{"class":475,"line":476},[473,896,480],{"class":479},[473,898,484],{"class":483},[473,900,487],{"class":479},[473,902,491],{"class":490},[473,904,494],{"class":483},[473,906,907],{"class":475,"line":497},[473,908,501],{"emptyLinePlaceholder":500},[473,910,911,913,915,917],{"class":475,"line":504},[473,912,507],{"class":479},[473,914,510],{"class":479},[473,916,514],{"class":513},[473,918,517],{"class":483},[473,920,921,924,926],{"class":475,"line":520},[473,922,923],{"class":483},"  preset: ",[473,925,538],{"class":490},[473,927,529],{"class":483},[473,929,930],{"class":475,"line":532},[473,931,932],{"class":483},"  experimental: {\n",[473,934,935,938,940],{"class":475,"line":543},[473,936,937],{"class":483},"    tasks: ",[473,939,556],{"class":555},[473,941,529],{"class":483},[473,943,944],{"class":475,"line":549},[473,945,946],{"class":483},"  },\n",[473,948,949],{"class":475,"line":561},[473,950,951],{"class":483},"  scheduledTasks: {\n",[473,953,954,957,960,963],{"class":475,"line":570},[473,955,956],{"class":490},"    \"* * * * *\"",[473,958,959],{"class":483},": [",[473,961,962],{"class":490},"\"cms:update\"",[473,964,965],{"class":483},"],\n",[473,967,968,971,973,976],{"class":475,"line":576},[473,969,970],{"class":490},"    \"0 15 1 * *\"",[473,972,959],{"class":483},[473,974,975],{"class":490},"\"db:cleanup\"",[473,977,965],{"class":483},[473,979,981],{"class":475,"line":980},11,[473,982,946],{"class":483},[473,984,986],{"class":475,"line":985},12,[473,987,850],{"class":483},[473,989,991,994,996],{"class":475,"line":990},13,[473,992,993],{"class":483},"    deployConfig: ",[473,995,556],{"class":555},[473,997,529],{"class":483},[473,999,1001],{"class":475,"line":1000},14,[473,1002,946],{"class":483},[473,1004,1006],{"class":475,"line":1005},15,[473,1007,579],{"class":483},[413,1009,1010],{},"No manual Wrangler configuration is needed - Nitro handles it for you.",[408,1012,1014],{"id":1013},"cloudflare-pages","Cloudflare Pages",[413,1016,1017,419,1019],{},[416,1018,418],{},[421,1020,1021],{},"cloudflare_pages",[425,1023],{"to":1024,"title":1014},"https:\u002F\u002Fpages.cloudflare.com\u002F",[429,1026,1027],{},[413,1028,433,1029,446],{},[435,1030,438],{"href":437},[814,1032,1033],{},[413,1034,1035,1036,1040],{},"Cloudflare ",[435,1037,1039],{"href":1038},"#cloudflare-workers","Workers Module"," is the new recommended preset for deployments. Please consider using the pages only if you need specific features.",[413,1042,459,1043,1045],{},[421,1044,462],{}," file for deploying a Nitro app to Cloudflare Pages.",[465,1047,1049],{"className":467,"code":1048,"filename":462,"language":469,"meta":5,"style":5},"import { defineConfig } from \"nitro\";\n\nexport default defineConfig({\n    preset: \"cloudflare_pages\",\n    cloudflare: {\n      deployConfig: true,\n      nodeCompat:true\n    }\n})\n",[421,1050,1051,1063,1067,1077,1086,1090,1098,1105,1109],{"__ignoreMap":5},[473,1052,1053,1055,1057,1059,1061],{"class":475,"line":476},[473,1054,480],{"class":479},[473,1056,484],{"class":483},[473,1058,487],{"class":479},[473,1060,491],{"class":490},[473,1062,494],{"class":483},[473,1064,1065],{"class":475,"line":497},[473,1066,501],{"emptyLinePlaceholder":500},[473,1068,1069,1071,1073,1075],{"class":475,"line":504},[473,1070,507],{"class":479},[473,1072,510],{"class":479},[473,1074,514],{"class":513},[473,1076,517],{"class":483},[473,1078,1079,1081,1084],{"class":475,"line":520},[473,1080,535],{"class":483},[473,1082,1083],{"class":490},"\"cloudflare_pages\"",[473,1085,529],{"class":483},[473,1087,1088],{"class":475,"line":532},[473,1089,546],{"class":483},[473,1091,1092,1094,1096],{"class":475,"line":543},[473,1093,552],{"class":483},[473,1095,556],{"class":555},[473,1097,529],{"class":483},[473,1099,1100,1103],{"class":475,"line":549},[473,1101,1102],{"class":483},"      nodeCompat:",[473,1104,567],{"class":555},[473,1106,1107],{"class":475,"line":561},[473,1108,573],{"class":483},[473,1110,1111],{"class":475,"line":570},[473,1112,579],{"class":483},[413,1114,1115,1116,1119,1120,1123,1124,1129],{},"Nitro automatically generates a ",[421,1117,1118],{},"_routes.json"," file that controls which routes get served from files and which are served from the Worker script. The auto-generated routes file can be overridden with the config option ",[421,1121,1122],{},"cloudflare.pages.routes"," (",[435,1125,1128],{"href":1126,"rel":1127},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fpages\u002Fplatform\u002Ffunctions\u002Frouting\u002F#functions-invocation-routes",[444],"read more",").",[623,1131,626],{"id":1132},"local-preview-1",[413,1134,629,1135,635],{},[435,1136,634],{"href":632,"rel":1137},[444],[637,1139],{"script":639},[641,1141],{"command":1142},"wrangler pages dev",[623,1144,647],{"id":1145},"manual-deploy-1",[413,1147,1148],{},"After having built your application you can manually deploy it with Wrangler, in order to do so first make sure to be\nlogged into your Cloudflare account:",[641,1150],{"command":656},[413,1152,659],{},[641,1154],{"command":1155},"wrangler pages deploy",[408,1157,1159],{"id":1158},"deploy-within-cicd-using-github-actions","Deploy within CI\u002FCD using GitHub Actions",[413,1161,1162,1163,1168],{},"Regardless on whether you're using Cloudflare Pages or Cloudflare Workers, you can use the ",[435,1164,1167],{"href":1165,"rel":1166},"https:\u002F\u002Fgithub.com\u002Fmarketplace\u002Factions\u002Fdeploy-to-cloudflare-workers-with-wrangler",[444],"Wrangler GitHub actions"," to deploy your application.",[429,1170,1171],{},[413,1172,1173,1176,1177,1181,1182,1184],{},[416,1174,1175],{},"Note:"," Remember to ",[435,1178,1180],{"href":1179},"\u002Fdeploy#changing-the-deployment-preset","instruct Nitro to use the correct preset"," (note that this is necessary for all presets including the ",[421,1183,1021],{}," one).",[408,1186,1188],{"id":1187},"environment-variables","Environment Variables",[413,1190,1191,1192,1195,1196,1199],{},"Nitro allows you to universally access environment variables using ",[421,1193,1194],{},"process.env"," or ",[421,1197,1198],{},"import.meta.env"," or the runtime config.",[429,1201,1202],{},[413,1203,1204,1205,1208],{},"Make sure to only access environment variables ",[416,1206,1207],{},"within the event lifecycle","  and not in global contexts since Cloudflare only makes them available during the request lifecycle and not before.",[413,1210,1211,1214,1215,1218,1219,1222],{},[416,1212,1213],{},"Example:"," If you have set the ",[421,1216,1217],{},"SECRET"," and ",[421,1220,1221],{},"NITRO_HELLO_THERE"," environment variables set you can access them in the following way:",[465,1224,1226],{"className":467,"code":1225,"language":469,"meta":5,"style":5},"import { defineHandler } from \"nitro\";\nimport { useRuntimeConfig } from \"nitro\u002Fruntime-config\";\n\nconsole.log(process.env.SECRET) \u002F\u002F note that this is in the global scope! so it doesn't actually work and the variable is undefined!\n\nexport default defineHandler((event) => {\n  \u002F\u002F note that all the below are valid ways of accessing the above mentioned variables\n  useRuntimeConfig().helloThere\n  useRuntimeConfig().secret\n  process.env.NITRO_HELLO_THERE\n  import.meta.env.SECRET\n});\n",[421,1227,1228,1241,1255,1259,1278,1282,1303,1308,1316,1323,1331,1347],{"__ignoreMap":5},[473,1229,1230,1232,1235,1237,1239],{"class":475,"line":476},[473,1231,480],{"class":479},[473,1233,1234],{"class":483}," { defineHandler } ",[473,1236,487],{"class":479},[473,1238,491],{"class":490},[473,1240,494],{"class":483},[473,1242,1243,1245,1248,1250,1253],{"class":475,"line":497},[473,1244,480],{"class":479},[473,1246,1247],{"class":483}," { useRuntimeConfig } ",[473,1249,487],{"class":479},[473,1251,1252],{"class":490}," \"nitro\u002Fruntime-config\"",[473,1254,494],{"class":483},[473,1256,1257],{"class":475,"line":504},[473,1258,501],{"emptyLinePlaceholder":500},[473,1260,1261,1264,1267,1270,1272,1275],{"class":475,"line":520},[473,1262,1263],{"class":483},"console.",[473,1265,1266],{"class":513},"log",[473,1268,1269],{"class":483},"(process.env.",[473,1271,1217],{"class":555},[473,1273,1274],{"class":483},") ",[473,1276,1277],{"class":798},"\u002F\u002F note that this is in the global scope! so it doesn't actually work and the variable is undefined!\n",[473,1279,1280],{"class":475,"line":532},[473,1281,501],{"emptyLinePlaceholder":500},[473,1283,1284,1286,1288,1291,1294,1296,1298,1301],{"class":475,"line":543},[473,1285,507],{"class":479},[473,1287,510],{"class":479},[473,1289,1290],{"class":513}," defineHandler",[473,1292,1293],{"class":483},"((",[473,1295,773],{"class":772},[473,1297,1274],{"class":483},[473,1299,1300],{"class":479},"=>",[473,1302,758],{"class":483},[473,1304,1305],{"class":475,"line":549},[473,1306,1307],{"class":798},"  \u002F\u002F note that all the below are valid ways of accessing the above mentioned variables\n",[473,1309,1310,1313],{"class":475,"line":561},[473,1311,1312],{"class":513},"  useRuntimeConfig",[473,1314,1315],{"class":483},"().helloThere\n",[473,1317,1318,1320],{"class":475,"line":570},[473,1319,1312],{"class":513},[473,1321,1322],{"class":483},"().secret\n",[473,1324,1325,1328],{"class":475,"line":576},[473,1326,1327],{"class":483},"  process.env.",[473,1329,1330],{"class":555},"NITRO_HELLO_THERE\n",[473,1332,1333,1336,1338,1341,1344],{"class":475,"line":980},[473,1334,1335],{"class":479},"  import",[473,1337,446],{"class":483},[473,1339,1340],{"class":555},"meta",[473,1342,1343],{"class":483},".env.",[473,1345,1346],{"class":555},"SECRET\n",[473,1348,1349],{"class":475,"line":985},[473,1350,1351],{"class":483},"});\n",[623,1353,1355],{"id":1354},"specify-variables-in-development-mode","Specify Variables in Development Mode",[413,1357,1358,1359,1195,1362,1365],{},"For development, you can use a ",[421,1360,1361],{},".env",[421,1363,1364],{},".env.local"," file to specify environment variables:",[465,1367,1371],{"className":1368,"code":1369,"language":1370,"meta":5,"style":5},"language-ini shiki shiki-themes github-light github-dark github-dark","NITRO_HELLO_THERE=\"captain\"\nSECRET=\"top-secret\"\n","ini",[421,1372,1373,1383],{"__ignoreMap":5},[473,1374,1375,1377,1380],{"class":475,"line":476},[473,1376,1221],{"class":479},[473,1378,1379],{"class":483},"=",[473,1381,1382],{"class":490},"\"captain\"\n",[473,1384,1385,1387,1389],{"class":475,"line":497},[473,1386,1217],{"class":479},[473,1388,1379],{"class":483},[473,1390,1391],{"class":490},"\"top-secret\"\n",[429,1393,1394],{},[413,1395,1396,1398,1399,1218,1401,1403,1404,1407],{},[416,1397,1175],{}," Make sure you add ",[421,1400,1361],{},[421,1402,1364],{}," to the ",[421,1405,1406],{},".gitignore"," file so that you don't commit it as it can contain sensitive information.",[623,1409,1411],{"id":1410},"specify-variables-for-local-previews","Specify Variables for local previews",[413,1413,1414,1415,1195,1417,1419,1420,1423,1424,1218,1429,1434],{},"After build, when you try out your project locally with ",[421,1416,643],{},[421,1418,1142],{},", in order to have access to environment variables you will need to specify the in a ",[421,1421,1422],{},".dev.vars"," file in the root of your project (as presented in the ",[435,1425,1428],{"href":1426,"rel":1427},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fpages\u002Ffunctions\u002Fbindings\u002F#interact-with-your-environment-variables-locally",[444],"Pages",[435,1430,1433],{"href":1431,"rel":1432},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002Fconfiguration\u002Fenvironment-variables\u002F#interact-with-environment-variables-locally",[444],"Workers"," documentation).",[413,1436,1437,1438,1195,1440,1442,1443,1445],{},"If you are using a ",[421,1439,1361],{},[421,1441,1364],{}," file while developing, your ",[421,1444,1422],{}," should be identical to it.",[429,1447,1448],{},[413,1449,1450,1398,1452,1403,1454,1407],{},[416,1451,1175],{},[421,1453,1422],{},[421,1455,1406],{},[623,1457,1459],{"id":1458},"specify-variables-for-production","Specify Variables for Production",[413,1461,1462,1463,1470],{},"For production, use the Cloudflare dashboard or the ",[435,1464,1467],{"href":1465,"rel":1466},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002Fwrangler\u002Fcommands\u002F#secret",[444],[421,1468,1469],{},"wrangler secret"," command to set environment variables and secrets.",[623,1472,1474,1475,400,1478],{"id":1473},"specify-variables-using-wranglertomlwranglerjson","Specify Variables using ",[421,1476,1477],{},"wrangler.toml",[421,1479,589],{},[413,1481,1482,1483,400,1485,1487],{},"You can specify a custom ",[421,1484,1477],{},[421,1486,589],{}," file and define vars inside.",[814,1489,1490],{},[413,1491,1492],{},"Note that this isn't recommended for sensitive data like secrets.",[413,1494,1495],{},[416,1496,1213],{},[1498,1499,1500,1563],"code-group",{},[465,1501,1503],{"className":1368,"code":1502,"filename":1477,"language":1370,"meta":5,"style":5},"# Shared\n[vars]\nNITRO_HELLO_THERE=\"general\"\nSECRET=\"secret\"\n\n# Override values for `--env production` usage\n[env.production.vars]\nNITRO_HELLO_THERE=\"captain\"\nSECRET=\"top-secret\"\n",[421,1504,1505,1510,1515,1524,1533,1537,1542,1547,1555],{"__ignoreMap":5},[473,1506,1507],{"class":475,"line":476},[473,1508,1509],{"class":798},"# Shared\n",[473,1511,1512],{"class":475,"line":497},[473,1513,1514],{"class":513},"[vars]\n",[473,1516,1517,1519,1521],{"class":475,"line":504},[473,1518,1221],{"class":479},[473,1520,1379],{"class":483},[473,1522,1523],{"class":490},"\"general\"\n",[473,1525,1526,1528,1530],{"class":475,"line":520},[473,1527,1217],{"class":479},[473,1529,1379],{"class":483},[473,1531,1532],{"class":490},"\"secret\"\n",[473,1534,1535],{"class":475,"line":532},[473,1536,501],{"emptyLinePlaceholder":500},[473,1538,1539],{"class":475,"line":543},[473,1540,1541],{"class":798},"# Override values for `--env production` usage\n",[473,1543,1544],{"class":475,"line":549},[473,1545,1546],{"class":513},"[env.production.vars]\n",[473,1548,1549,1551,1553],{"class":475,"line":561},[473,1550,1221],{"class":479},[473,1552,1379],{"class":483},[473,1554,1382],{"class":490},[473,1556,1557,1559,1561],{"class":475,"line":570},[473,1558,1217],{"class":479},[473,1560,1379],{"class":483},[473,1562,1391],{"class":490},[465,1564,1568],{"className":1565,"code":1566,"filename":589,"language":1567,"meta":5,"style":5},"language-json shiki shiki-themes github-light github-dark github-dark","{\n  \"vars\": {\n    \"NITRO_HELLO_THERE\": \"general\",\n    \"SECRET\": \"secret\"\n  },\n  \"env\": {\n    \"production\": {\n      \"vars\": {\n        \"NITRO_HELLO_THERE\": \"captain\",\n        \"SECRET\": \"top-secret\"\n      }\n    }\n  }\n}\n\n","json",[421,1569,1570,1575,1583,1596,1605,1609,1616,1623,1630,1642,1651,1656,1660,1664],{"__ignoreMap":5},[473,1571,1572],{"class":475,"line":476},[473,1573,1574],{"class":483},"{\n",[473,1576,1577,1580],{"class":475,"line":497},[473,1578,1579],{"class":555},"  \"vars\"",[473,1581,1582],{"class":483},": {\n",[473,1584,1585,1588,1591,1594],{"class":475,"line":504},[473,1586,1587],{"class":555},"    \"NITRO_HELLO_THERE\"",[473,1589,1590],{"class":483},": ",[473,1592,1593],{"class":490},"\"general\"",[473,1595,529],{"class":483},[473,1597,1598,1601,1603],{"class":475,"line":520},[473,1599,1600],{"class":555},"    \"SECRET\"",[473,1602,1590],{"class":483},[473,1604,1532],{"class":490},[473,1606,1607],{"class":475,"line":532},[473,1608,946],{"class":483},[473,1610,1611,1614],{"class":475,"line":543},[473,1612,1613],{"class":555},"  \"env\"",[473,1615,1582],{"class":483},[473,1617,1618,1621],{"class":475,"line":549},[473,1619,1620],{"class":555},"    \"production\"",[473,1622,1582],{"class":483},[473,1624,1625,1628],{"class":475,"line":561},[473,1626,1627],{"class":555},"      \"vars\"",[473,1629,1582],{"class":483},[473,1631,1632,1635,1637,1640],{"class":475,"line":570},[473,1633,1634],{"class":555},"        \"NITRO_HELLO_THERE\"",[473,1636,1590],{"class":483},[473,1638,1639],{"class":490},"\"captain\"",[473,1641,529],{"class":483},[473,1643,1644,1647,1649],{"class":475,"line":576},[473,1645,1646],{"class":555},"        \"SECRET\"",[473,1648,1590],{"class":483},[473,1650,1391],{"class":490},[473,1652,1653],{"class":475,"line":980},[473,1654,1655],{"class":483},"      }\n",[473,1657,1658],{"class":475,"line":985},[473,1659,573],{"class":483},[473,1661,1662],{"class":475,"line":990},[473,1663,804],{"class":483},[473,1665,1666],{"class":475,"line":1000},[473,1667,809],{"class":483},[408,1669,1671],{"id":1670},"direct-access-to-cloudflare-bindings","Direct access to Cloudflare bindings",[413,1673,1674,1675,1680,1681,1129],{},"Bindings are what allows you to interact with resources from the Cloudflare platform, examples of such resources are key-value data storages (",[435,1676,1679],{"href":1677,"rel":1678},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fkv\u002F",[444],"KVs",") and serverless SQL databases (",[435,1682,1685],{"href":1683,"rel":1684},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fd1\u002F",[444],"D1s",[425,1687,1688],{},[413,1689,1690,1691,1218,1695,1699],{},"For more details on Bindings and how to use them please refer to the Cloudflare ",[435,1692,1428],{"href":1693,"rel":1694},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fpages\u002Ffunctions\u002Fbindings\u002F",[444],[435,1696,1433],{"href":1697,"rel":1698},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002Fconfiguration\u002Fbindings\u002F#bindings",[444]," documentation.",[1701,1702,1703],"tip",{},[413,1704,1705,1706,1218,1708,1710],{},"\nNitro provides high level API to interact with primitives such as ",[435,1707,78],{"href":79},[435,1709,38],{"href":39}," and you are highly recommended to prefer using them instead of directly depending on low-level APIs for usage stability.",[425,1712],{"to":39,"title":1713},"Database Layer",[425,1715],{"to":79,"title":78},[413,1717,1718,1719,1722],{},"In runtime, you can access bindings from the request event via ",[421,1720,1721],{},"event.req.runtime.cloudflare.env",". This is for example how you can access a D1 binding:",[465,1724,1726],{"className":467,"code":1725,"language":469,"meta":5,"style":5},"import { defineHandler } from \"nitro\";\n\ndefineHandler(async (event) => {\n  const { env } = event.req.runtime.cloudflare\n  const stmt = await env.MY_D1.prepare('SELECT id FROM table')\n  const { results } = await stmt.all()\n})\n",[421,1727,1728,1740,1744,1764,1783,1815,1839],{"__ignoreMap":5},[473,1729,1730,1732,1734,1736,1738],{"class":475,"line":476},[473,1731,480],{"class":479},[473,1733,1234],{"class":483},[473,1735,487],{"class":479},[473,1737,491],{"class":490},[473,1739,494],{"class":483},[473,1741,1742],{"class":475,"line":497},[473,1743,501],{"emptyLinePlaceholder":500},[473,1745,1746,1749,1751,1754,1756,1758,1760,1762],{"class":475,"line":504},[473,1747,1748],{"class":513},"defineHandler",[473,1750,769],{"class":483},[473,1752,1753],{"class":479},"async",[473,1755,1123],{"class":483},[473,1757,773],{"class":772},[473,1759,1274],{"class":483},[473,1761,1300],{"class":479},[473,1763,758],{"class":483},[473,1765,1766,1769,1772,1775,1778,1780],{"class":475,"line":520},[473,1767,1768],{"class":479},"  const",[473,1770,1771],{"class":483}," { ",[473,1773,1774],{"class":555},"env",[473,1776,1777],{"class":483}," } ",[473,1779,1379],{"class":479},[473,1781,1782],{"class":483}," event.req.runtime.cloudflare\n",[473,1784,1785,1787,1790,1793,1796,1799,1802,1804,1807,1809,1812],{"class":475,"line":532},[473,1786,1768],{"class":479},[473,1788,1789],{"class":555}," stmt",[473,1791,1792],{"class":479}," =",[473,1794,1795],{"class":479}," await",[473,1797,1798],{"class":483}," env.",[473,1800,1801],{"class":555},"MY_D1",[473,1803,446],{"class":483},[473,1805,1806],{"class":513},"prepare",[473,1808,769],{"class":483},[473,1810,1811],{"class":490},"'SELECT id FROM table'",[473,1813,1814],{"class":483},")\n",[473,1816,1817,1819,1821,1824,1826,1828,1830,1833,1836],{"class":475,"line":543},[473,1818,1768],{"class":479},[473,1820,1771],{"class":483},[473,1822,1823],{"class":555},"results",[473,1825,1777],{"class":483},[473,1827,1379],{"class":479},[473,1829,1795],{"class":479},[473,1831,1832],{"class":483}," stmt.",[473,1834,1835],{"class":513},"all",[473,1837,1838],{"class":483},"()\n",[473,1840,1841],{"class":475,"line":549},[473,1842,579],{"class":483},[623,1844,1846],{"id":1845},"access-to-the-bindings-in-local-dev","Access to the bindings in local dev",[413,1848,1849,1850,400,1853,400,1855,1857],{},"To access bindings in dev mode, we first define them. You can do this in a ",[421,1851,1852],{},"wrangler.jsonc",[421,1854,589],{},[421,1856,1477],{}," file",[413,1859,1860,1861,776],{},"For example, to define a variable and a KV namespace in ",[421,1862,1477],{},[1498,1864,1865,1917],{},[465,1866,1868],{"className":1368,"code":1867,"filename":1477,"language":1370,"meta":5,"style":5},"[vars]\nMY_VARIABLE=\"my-value\"\n\n[[kv_namespaces]]\nbinding = \"MY_KV\"\nid = \"xxx\"\n",[421,1869,1870,1874,1884,1888,1896,1907],{"__ignoreMap":5},[473,1871,1872],{"class":475,"line":476},[473,1873,1514],{"class":513},[473,1875,1876,1879,1881],{"class":475,"line":497},[473,1877,1878],{"class":479},"MY_VARIABLE",[473,1880,1379],{"class":483},[473,1882,1883],{"class":490},"\"my-value\"\n",[473,1885,1886],{"class":475,"line":504},[473,1887,501],{"emptyLinePlaceholder":500},[473,1889,1890,1893],{"class":475,"line":520},[473,1891,1892],{"class":513},"[[kv_namespaces]",[473,1894,1895],{"class":483},"]\n",[473,1897,1898,1901,1904],{"class":475,"line":532},[473,1899,1900],{"class":479},"binding",[473,1902,1903],{"class":483}," = ",[473,1905,1906],{"class":490},"\"MY_KV\"\n",[473,1908,1909,1912,1914],{"class":475,"line":543},[473,1910,1911],{"class":479},"id",[473,1913,1903],{"class":483},[473,1915,1916],{"class":490},"\"xxx\"\n",[465,1918,1920],{"className":1565,"code":1919,"filename":589,"language":1567,"meta":5,"style":5},"{\n  \"vars\": {\n    \"MY_VARIABLE\": \"my-value\",\n  },\n  \"kv_namespaces\": [\n    {\n      \"binding\": \"MY_KV\",\n      \"id\": \"xxx\"\n    }\n  ]\n}\n",[421,1921,1922,1926,1932,1944,1948,1956,1961,1973,1982,1986,1991],{"__ignoreMap":5},[473,1923,1924],{"class":475,"line":476},[473,1925,1574],{"class":483},[473,1927,1928,1930],{"class":475,"line":497},[473,1929,1579],{"class":555},[473,1931,1582],{"class":483},[473,1933,1934,1937,1939,1942],{"class":475,"line":504},[473,1935,1936],{"class":555},"    \"MY_VARIABLE\"",[473,1938,1590],{"class":483},[473,1940,1941],{"class":490},"\"my-value\"",[473,1943,529],{"class":483},[473,1945,1946],{"class":475,"line":520},[473,1947,946],{"class":483},[473,1949,1950,1953],{"class":475,"line":532},[473,1951,1952],{"class":555},"  \"kv_namespaces\"",[473,1954,1955],{"class":483},": [\n",[473,1957,1958],{"class":475,"line":543},[473,1959,1960],{"class":483},"    {\n",[473,1962,1963,1966,1968,1971],{"class":475,"line":549},[473,1964,1965],{"class":555},"      \"binding\"",[473,1967,1590],{"class":483},[473,1969,1970],{"class":490},"\"MY_KV\"",[473,1972,529],{"class":483},[473,1974,1975,1978,1980],{"class":475,"line":561},[473,1976,1977],{"class":555},"      \"id\"",[473,1979,1590],{"class":483},[473,1981,1916],{"class":490},[473,1983,1984],{"class":475,"line":570},[473,1985,573],{"class":483},[473,1987,1988],{"class":475,"line":576},[473,1989,1990],{"class":483},"  ]\n",[473,1992,1993],{"class":475,"line":980},[473,1994,809],{"class":483},[413,1996,1997,1998,2001],{},"Next we install the required ",[421,1999,2000],{},"wrangler"," package (if not already installed):",[2003,2004],"pm-install",{"name":2005},"wrangler -D",[413,2007,2008],{},"From this moment, when running",[637,2010],{"script":2011},"dev",[413,2013,2014,2015,1218,2017,2020],{},"you will be able to access the ",[421,2016,1878],{},[421,2018,2019],{},"MY_KV"," from the request event just as illustrated above.",[2022,2023,2025],"h4",{"id":2024},"wrangler-environments","Wrangler environments",[413,2027,2028],{},"If you have multiple Wrangler environments, you can specify which Wrangler environment to use during Cloudflare dev emulation:",[465,2030,2032],{"className":467,"code":2031,"filename":462,"language":469,"meta":5,"style":5},"import { defineConfig } from \"nitro\";\n\nexport default defineConfig({\n  preset: 'cloudflare_module',\n  cloudflare: {\n    dev: {\n      environment: 'preview'\n    }\n  }\n})\n",[421,2033,2034,2046,2050,2060,2069,2073,2078,2086,2090,2094],{"__ignoreMap":5},[473,2035,2036,2038,2040,2042,2044],{"class":475,"line":476},[473,2037,480],{"class":479},[473,2039,484],{"class":483},[473,2041,487],{"class":479},[473,2043,491],{"class":490},[473,2045,494],{"class":483},[473,2047,2048],{"class":475,"line":497},[473,2049,501],{"emptyLinePlaceholder":500},[473,2051,2052,2054,2056,2058],{"class":475,"line":504},[473,2053,507],{"class":479},[473,2055,510],{"class":479},[473,2057,514],{"class":513},[473,2059,517],{"class":483},[473,2061,2062,2064,2067],{"class":475,"line":520},[473,2063,923],{"class":483},[473,2065,2066],{"class":490},"'cloudflare_module'",[473,2068,529],{"class":483},[473,2070,2071],{"class":475,"line":532},[473,2072,850],{"class":483},[473,2074,2075],{"class":475,"line":543},[473,2076,2077],{"class":483},"    dev: {\n",[473,2079,2080,2083],{"class":475,"line":549},[473,2081,2082],{"class":483},"      environment: ",[473,2084,2085],{"class":490},"'preview'\n",[473,2087,2088],{"class":475,"line":561},[473,2089,573],{"class":483},[473,2091,2092],{"class":475,"line":570},[473,2093,804],{"class":483},[473,2095,2096],{"class":475,"line":576},[473,2097,579],{"class":483},[2099,2100,2101],"style",{},"html pre.shiki code .so5gQ, html code.shiki .so5gQ{--shiki-light:#D73A49;--shiki-default:#F97583;--shiki-dark:#F97583}html pre.shiki code .slsVL, html code.shiki .slsVL{--shiki-light:#24292E;--shiki-default:#E1E4E8;--shiki-dark:#E1E4E8}html pre.shiki code .sfrk1, html code.shiki .sfrk1{--shiki-light:#032F62;--shiki-default:#9ECBFF;--shiki-dark:#9ECBFF}html pre.shiki code .shcOC, html code.shiki .shcOC{--shiki-light:#6F42C1;--shiki-default:#B392F0;--shiki-dark:#B392F0}html pre.shiki code .suiK_, html code.shiki .suiK_{--shiki-light:#005CC5;--shiki-default:#79B8FF;--shiki-dark:#79B8FF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sQHwn, html code.shiki .sQHwn{--shiki-light:#E36209;--shiki-default:#FFAB70;--shiki-dark:#FFAB70}html pre.shiki code .sCsY4, html code.shiki .sCsY4{--shiki-light:#6A737D;--shiki-default:#6A737D;--shiki-dark:#6A737D}",{"title":5,"searchDepth":497,"depth":497,"links":2103},[2104,2111,2115,2116,2123],{"id":410,"depth":497,"text":411,"children":2105},[2106,2107,2108,2109,2110],{"id":625,"depth":504,"text":626},{"id":646,"depth":504,"text":647},{"id":665,"depth":504,"text":666},{"id":726,"depth":504,"text":727},{"id":869,"depth":504,"text":870},{"id":1013,"depth":497,"text":1014,"children":2112},[2113,2114],{"id":1132,"depth":504,"text":626},{"id":1145,"depth":504,"text":647},{"id":1158,"depth":497,"text":1159},{"id":1187,"depth":497,"text":1188,"children":2117},[2118,2119,2120,2121],{"id":1354,"depth":504,"text":1355},{"id":1410,"depth":504,"text":1411},{"id":1458,"depth":504,"text":1459},{"id":1473,"depth":504,"text":2122},"Specify Variables using wrangler.toml\u002Fwrangler.json",{"id":1670,"depth":497,"text":1671,"children":2124},[2125],{"id":1845,"depth":504,"text":1846},"Deploy Nitro apps to Cloudflare.","md",{},{},{"title":147,"description":2126},"lC_SHddFlsI6mdOByqvaxaLQzQWBK7wMuxu1e4_uSps",[2133,2135],{"title":143,"path":144,"stem":145,"description":2134,"children":-1},"Deploy Nitro apps to Cleavr.",{"title":151,"path":152,"stem":153,"description":2136,"children":-1},"Deploy Nitro apps to Deno Deploy.",1776863250756]