[{"data":1,"prerenderedAt":1385},["ShallowReactive",2],{"navigation_docs":3,"-rpc-platforms-cloudflare":399},[4,162,346],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":24},"RPC","icon-park-outline:lightning","\u002Frpc","01.rpc",[10,25,63,77,102,136],{"title":11,"icon":12,"redirect":7,"path":13,"stem":14,"children":15,"page":24},"Introduction","icon-park-outline:home","\u002Frpc\u002Fintroduction","01.rpc\u002F01.introduction",[16,20],{"title":17,"path":18,"stem":19},"Quick Start","\u002Frpc\u002Fintroduction\u002Fquick-start","01.rpc\u002F01.introduction\u002F02.quick-start",{"title":21,"path":22,"stem":23},"Manual Install","\u002Frpc\u002Fintroduction\u002Fmanual-install","01.rpc\u002F01.introduction\u002F03.manual-install",false,{"title":26,"icon":27,"path":28,"stem":29,"children":30,"page":24},"Server","icon-park-outline:server","\u002Frpc\u002Fserver","01.rpc\u002F02.server",[31,35,39,43,47,51,55,59],{"title":32,"path":33,"stem":34},"Routes","\u002Frpc\u002Fserver\u002Froutes","01.rpc\u002F02.server\u002F01.routes",{"title":36,"path":37,"stem":38},"Middleware","\u002Frpc\u002Fserver\u002Fmiddleware","01.rpc\u002F02.server\u002F02.middleware",{"title":40,"path":41,"stem":42},"Call Context","\u002Frpc\u002Fserver\u002Fcall-context","01.rpc\u002F02.server\u002F03.call-context",{"title":44,"path":45,"stem":46},"Headers","\u002Frpc\u002Fserver\u002Fheaders","01.rpc\u002F02.server\u002F04.headers",{"title":48,"path":49,"stem":50},"Error Handling","\u002Frpc\u002Fserver\u002Ferror-handling","01.rpc\u002F02.server\u002F05.error-handling",{"title":52,"path":53,"stem":54},"Validation","\u002Frpc\u002Fserver\u002Fvalidation","01.rpc\u002F02.server\u002F06.validation",{"title":56,"path":57,"stem":58},"JSON Round Trip","\u002Frpc\u002Fserver\u002Fjson-round-trip","01.rpc\u002F02.server\u002F07.json-round-trip",{"title":60,"path":61,"stem":62},"Drizzle Tables","\u002Frpc\u002Fserver\u002Fdrizzle-tables","01.rpc\u002F02.server\u002F08.drizzle-tables",{"title":64,"icon":65,"path":66,"stem":67,"children":68,"page":24},"Middlewares","icon-park-outline:link-one","\u002Frpc\u002Fmiddlewares","01.rpc\u002F03.middlewares",[69,73],{"title":70,"path":71,"stem":72},"fetchMetadata","\u002Frpc\u002Fmiddlewares\u002Ffetch-metadata","01.rpc\u002F03.middlewares\u002F01.fetch-metadata",{"title":74,"path":75,"stem":76},"syncRoutes","\u002Frpc\u002Fmiddlewares\u002Fsync-routes","01.rpc\u002F03.middlewares\u002F02.sync-routes",{"title":78,"icon":79,"path":80,"stem":81,"children":82,"page":24},"Client","icon-park-outline:computer","\u002Frpc\u002Fclient","01.rpc\u002F04.client",[83,87,91,94,98],{"title":84,"path":85,"stem":86},"Client Overview","\u002Frpc\u002Fclient\u002Fclient-overview","01.rpc\u002F04.client\u002F00.client-overview",{"title":88,"path":89,"stem":90},"Client Middleware","\u002Frpc\u002Fclient\u002Fclient-middleware","01.rpc\u002F04.client\u002F01.client-middleware",{"title":48,"path":92,"stem":93},"\u002Frpc\u002Fclient\u002Ferror-handling","01.rpc\u002F04.client\u002F02.error-handling",{"title":95,"path":96,"stem":97},"Batch Requests","\u002Frpc\u002Fclient\u002Fbatch","01.rpc\u002F04.client\u002F03.batch",{"title":99,"path":100,"stem":101},"Cancellation & Timeouts","\u002Frpc\u002Fclient\u002Fcancellation-timeouts","01.rpc\u002F04.client\u002F04.cancellation-timeouts",{"title":103,"redirect":104,"icon":105,"path":106,"stem":107,"children":108,"page":24},"Platforms","\u002Frpc\u002Fplatforms\u002Fnode-js","icon-park-outline:play","\u002Frpc\u002Fplatforms","01.rpc\u002F06.platforms",[109,112,116,120,124,128,132],{"title":110,"path":104,"stem":111},"Node.js","01.rpc\u002F06.platforms\u002F01.node-js",{"title":113,"path":114,"stem":115},"Bun","\u002Frpc\u002Fplatforms\u002Fbun","01.rpc\u002F06.platforms\u002F02.bun",{"title":117,"path":118,"stem":119},"AWS Lambda","\u002Frpc\u002Fplatforms\u002Faws-lambda","01.rpc\u002F06.platforms\u002F03.aws-lambda",{"title":121,"path":122,"stem":123},"Google Cloud Functions","\u002Frpc\u002Fplatforms\u002Fgoogle-cloud-functions","01.rpc\u002F06.platforms\u002F04.google-cloud-functions",{"title":125,"path":126,"stem":127},"Cloudflare Workers","\u002Frpc\u002Fplatforms\u002Fcloudflare","01.rpc\u002F06.platforms\u002F05.cloudflare",{"title":129,"path":130,"stem":131},"Vercel","\u002Frpc\u002Fplatforms\u002Fvercel","01.rpc\u002F06.platforms\u002F06.vercel",{"title":133,"path":134,"stem":135},"uWebSockets.js","\u002Frpc\u002Fplatforms\u002Fuwebsockets","01.rpc\u002F06.platforms\u002F07.uwebsockets",{"title":137,"icon":138,"path":139,"stem":140,"children":141,"page":24},"Devtools","icon-park-outline:tool","\u002Frpc\u002Fdevtools","01.rpc\u002F07.devtools",[142,146,150,154,158],{"title":143,"path":144,"stem":145},"Linter","\u002Frpc\u002Fdevtools\u002Flinter","01.rpc\u002F07.devtools\u002F01.linter",{"title":147,"path":148,"stem":149},"Vite","\u002Frpc\u002Fdevtools\u002Fvite","01.rpc\u002F07.devtools\u002F02.vite",{"title":151,"path":152,"stem":153},"Next.js","\u002Frpc\u002Fdevtools\u002Fnextjs","01.rpc\u002F07.devtools\u002F03.nextjs",{"title":155,"path":156,"stem":157},"CLI","\u002Frpc\u002Fdevtools\u002Fcli","01.rpc\u002F07.devtools\u002F04.cli",{"title":159,"path":160,"stem":161},"API Types","\u002Frpc\u002Fdevtools\u002Fapi-types","01.rpc\u002F07.devtools\u002F05.api-types",{"title":163,"icon":164,"path":165,"stem":166,"children":167,"page":24},"RunTypes","i-lucide-braces","\u002Fruntypes","02.runtypes",[168,184,224,254,268,290,332],{"title":11,"icon":169,"redirect":165,"path":170,"stem":171,"children":172,"page":24},"i-lucide-rocket","\u002Fruntypes\u002Fintroduction","02.runtypes\u002F01.introduction",[173,177,180],{"title":174,"path":175,"stem":176},"Built on typescript-go","\u002Fruntypes\u002Fintroduction\u002Fbuilt-on-typescript-go","02.runtypes\u002F01.introduction\u002F02.built-on-typescript-go",{"title":17,"path":178,"stem":179},"\u002Fruntypes\u002Fintroduction\u002Fquick-start","02.runtypes\u002F01.introduction\u002F03.quick-start",{"title":181,"path":182,"stem":183},"Configuration","\u002Fruntypes\u002Fintroduction\u002Fconfiguration","02.runtypes\u002F01.introduction\u002F04.configuration",{"title":185,"icon":186,"redirect":187,"path":188,"stem":189,"children":190,"page":24},"Guide","i-lucide-book-open","\u002Fruntypes\u002Fguide\u002Ftype-builders","\u002Fruntypes\u002Fguide","02.runtypes\u002F02.guide",[191,194,198,201,204,208,212,216,220],{"title":192,"path":187,"stem":193},"Types vs Type Builders","02.runtypes\u002F02.guide\u002F01.type-builders",{"title":195,"path":196,"stem":197},"Reflection","\u002Fruntypes\u002Fguide\u002Freflection","02.runtypes\u002F02.guide\u002F02.reflection",{"title":52,"path":199,"stem":200},"\u002Fruntypes\u002Fguide\u002Fvalidation","02.runtypes\u002F02.guide\u002F03.validation",{"title":56,"path":202,"stem":203},"\u002Fruntypes\u002Fguide\u002Fjson-round-trip","02.runtypes\u002F02.guide\u002F04.json-round-trip",{"title":205,"path":206,"stem":207},"Data Mocking","\u002Fruntypes\u002Fguide\u002Fmocking","02.runtypes\u002F02.guide\u002F07.mocking",{"title":209,"path":210,"stem":211},"JSON Schemas","\u002Fruntypes\u002Fguide\u002Fjson-schemas","02.runtypes\u002F02.guide\u002F08.json-schemas",{"title":213,"path":214,"stem":215},"Pure Functions","\u002Fruntypes\u002Fguide\u002Fpure-functions","02.runtypes\u002F02.guide\u002F09.pure-functions",{"title":217,"path":218,"stem":219},"Compiler Markers","\u002Fruntypes\u002Fguide\u002Fcompiler-markers","02.runtypes\u002F02.guide\u002F10.compiler-markers",{"title":221,"path":222,"stem":223},"All Compiled Functions","\u002Fruntypes\u002Fguide\u002Fall-compiled-functions","02.runtypes\u002F02.guide\u002F11.all-compiled-functions",{"title":225,"icon":226,"redirect":227,"path":228,"stem":229,"children":230,"page":24},"Type Formats","i-lucide-shapes","\u002Fruntypes\u002Ftype-formats\u002Foverview","\u002Fruntypes\u002Ftype-formats","02.runtypes\u002F03.type-formats",[231,234,238,242,246,250],{"title":232,"path":227,"stem":233},"Overview","02.runtypes\u002F03.type-formats\u002F01.overview",{"title":235,"path":236,"stem":237},"String Formats","\u002Fruntypes\u002Ftype-formats\u002Fstring","02.runtypes\u002F03.type-formats\u002F02.string",{"title":239,"path":240,"stem":241},"Number Formats","\u002Fruntypes\u002Ftype-formats\u002Fnumber","02.runtypes\u002F03.type-formats\u002F03.number",{"title":243,"path":244,"stem":245},"BigInt Formats","\u002Fruntypes\u002Ftype-formats\u002Fbigint","02.runtypes\u002F03.type-formats\u002F04.bigint",{"title":247,"path":248,"stem":249},"Date and Time Formats","\u002Fruntypes\u002Ftype-formats\u002Fdate-time","02.runtypes\u002F03.type-formats\u002F05.date-time",{"title":251,"path":252,"stem":253},"Collection Formats","\u002Fruntypes\u002Ftype-formats\u002Fcollections","02.runtypes\u002F03.type-formats\u002F06.collections",{"title":255,"icon":256,"redirect":257,"path":258,"stem":259,"children":260,"page":24},"Tooling","i-lucide-wrench","\u002Fruntypes\u002Ftooling\u002Flinting","\u002Fruntypes\u002Ftooling","02.runtypes\u002F04.tooling",[261,264],{"title":262,"path":257,"stem":263},"Linting","02.runtypes\u002F04.tooling\u002F01.linting",{"title":265,"path":266,"stem":267},"Source Conversion","\u002Fruntypes\u002Ftooling\u002Fsource-conversion","02.runtypes\u002F04.tooling\u002F02.source-conversion",{"title":269,"icon":270,"redirect":271,"path":272,"stem":273,"children":274,"page":24},"AI Integration","i-lucide-sparkles","\u002Fruntypes\u002Fai-integration\u002Fworkflow-and-commands","\u002Fruntypes\u002Fai-integration","02.runtypes\u002F05.ai-integration",[275,278,282,286],{"title":276,"path":271,"stem":277},"AI Workflow","02.runtypes\u002F05.ai-integration\u002F01.workflow-and-commands",{"title":279,"path":280,"stem":281},"FriendlyText","\u002Fruntypes\u002Fai-integration\u002Ffriendly-text","02.runtypes\u002F05.ai-integration\u002F02.friendly-text",{"title":283,"path":284,"stem":285},"MockData","\u002Fruntypes\u002Fai-integration\u002Fmock-data","02.runtypes\u002F05.ai-integration\u002F03.mock-data",{"title":287,"path":288,"stem":289},"Translations (i18n)","\u002Fruntypes\u002Fai-integration\u002Fi18n","02.runtypes\u002F05.ai-integration\u002F04.i18n",{"title":291,"icon":292,"redirect":293,"path":294,"stem":295,"children":296,"page":24},"Drizzle ORM","i-lineicons-drizzle","\u002Fruntypes\u002Fdrizzle-orm\u002Fdrizzle-overview","\u002Fruntypes\u002Fdrizzle-orm","02.runtypes\u002F06.drizzle-orm",[297,300,304,308,312,316,320,324,328],{"title":298,"path":293,"stem":299},"Drizzle Overview","02.runtypes\u002F06.drizzle-orm\u002F00.drizzle-overview",{"title":301,"path":302,"stem":303},"Column Formats","\u002Fruntypes\u002Fdrizzle-orm\u002Fcolumn-formats","02.runtypes\u002F06.drizzle-orm\u002F01.column-formats",{"title":305,"path":306,"stem":307},"Views","\u002Fruntypes\u002Fdrizzle-orm\u002Fviews","02.runtypes\u002F06.drizzle-orm\u002F02.views",{"title":309,"path":310,"stem":311},"Indexes and Constraints","\u002Fruntypes\u002Fdrizzle-orm\u002Fconstraints","02.runtypes\u002F06.drizzle-orm\u002F03.constraints",{"title":313,"path":314,"stem":315},"Row Level Security","\u002Fruntypes\u002Fdrizzle-orm\u002Frow-level-security","02.runtypes\u002F06.drizzle-orm\u002F04.row-level-security",{"title":317,"path":318,"stem":319},"Relations","\u002Fruntypes\u002Fdrizzle-orm\u002Frelations","02.runtypes\u002F06.drizzle-orm\u002F05.relations",{"title":321,"path":322,"stem":323},"The Schema File","\u002Fruntypes\u002Fdrizzle-orm\u002Fschema-file","02.runtypes\u002F06.drizzle-orm\u002F06.schema-file",{"title":325,"path":326,"stem":327},"Migrate an Existing Schema","\u002Fruntypes\u002Fdrizzle-orm\u002Fmigrate-an-existing-schema","02.runtypes\u002F06.drizzle-orm\u002F07.migrate-an-existing-schema",{"title":329,"path":330,"stem":331},"Cloudflare D1 and Durable Objects","\u002Fruntypes\u002Fdrizzle-orm\u002Fcloudflare-storage","02.runtypes\u002F06.drizzle-orm\u002F08.cloudflare-storage",{"title":333,"icon":334,"redirect":335,"path":336,"stem":337,"children":338,"page":24},"Diagnostics","i-lucide-triangle-alert","\u002Fruntypes\u002Fdiagnostics\u002Ferror-levels","\u002Fruntypes\u002Fdiagnostics","02.runtypes\u002F08.diagnostics",[339,342],{"title":340,"path":335,"stem":341},"Error Levels","02.runtypes\u002F08.diagnostics\u002F01.error-levels",{"title":343,"path":344,"stem":345},"All Diagnostics","\u002Fruntypes\u002Fdiagnostics\u002Fall-diagnostics","02.runtypes\u002F08.diagnostics\u002F02.all-diagnostics",{"title":347,"icon":348,"path":349,"stem":350,"children":351,"page":24},"Benchmarks","i-lucide-gauge","\u002Fbenchmarks","03.benchmarks",[352,372],{"title":5,"icon":6,"redirect":353,"path":354,"stem":355,"children":356,"page":24},"\u002Fbenchmarks\u002Frpc\u002Fhello-world","\u002Fbenchmarks\u002Frpc","03.benchmarks\u002F02.rpc",[357,360,364,368],{"title":358,"path":353,"stem":359},"Hello World","03.benchmarks\u002F02.rpc\u002F01.hello-world",{"title":361,"path":362,"stem":363},"Light Validation","\u002Fbenchmarks\u002Frpc\u002Flight-validation","03.benchmarks\u002F02.rpc\u002F02.light-validation",{"title":365,"path":366,"stem":367},"Heavy Validation","\u002Fbenchmarks\u002Frpc\u002Fheavy-validation","03.benchmarks\u002F02.rpc\u002F03.heavy-validation",{"title":369,"path":370,"stem":371},"Payload Sizes","\u002Fbenchmarks\u002Frpc\u002Fpayload-sizes","03.benchmarks\u002F02.rpc\u002F04.payload-sizes",{"title":163,"icon":164,"redirect":373,"path":374,"stem":375,"children":376,"page":24},"\u002Fbenchmarks\u002Fruntypes\u002Fis-valid","\u002Fbenchmarks\u002Fruntypes","03.benchmarks\u002F03.runtypes",[377,380,384,388,392,395],{"title":378,"path":373,"stem":379},"Is Valid","03.benchmarks\u002F03.runtypes\u002F01.is-valid",{"title":381,"path":382,"stem":383},"Is Valid Formats","\u002Fbenchmarks\u002Fruntypes\u002Fis-valid-formats","03.benchmarks\u002F03.runtypes\u002F02.is-valid-formats",{"title":385,"path":386,"stem":387},"Get Errors","\u002Fbenchmarks\u002Fruntypes\u002Fget-errors","03.benchmarks\u002F03.runtypes\u002F03.get-errors",{"title":389,"path":390,"stem":391},"Get Errors Formats","\u002Fbenchmarks\u002Fruntypes\u002Fget-errors-formats","03.benchmarks\u002F03.runtypes\u002F04.get-errors-formats",{"title":56,"path":393,"stem":394},"\u002Fbenchmarks\u002Fruntypes\u002Fjson-round-trip","03.benchmarks\u002F03.runtypes\u002F05.json-round-trip",{"title":396,"path":397,"stem":398},"Type Checking","\u002Fbenchmarks\u002Fruntypes\u002Ftype-checking","03.benchmarks\u002F03.runtypes\u002F07.type-checking",{"id":400,"title":125,"body":401,"description":1379,"extension":1380,"links":1381,"meta":1382,"navigation":514,"path":126,"seo":1383,"stem":127,"__hash__":1384},"docs\u002F01.rpc\u002F06.platforms\u002F05.cloudflare.md",{"type":402,"value":403},"minimark",[404,416,421,449,453,767,771,791,813,817,852,949,972,976,985,1038,1363,1366,1370,1375],[405,406,407,411,412,415],"p",{},[408,409,410],"code",{},"@mionjs\u002Fplatform-cloudflare"," provides a Web standard ",[408,413,414],{},"Request -> Response"," fetch handler with access to Worker bindings.",[417,418,420],"h2",{"id":419},"installing-the-adapter","Installing the Adapter",[422,423,428],"pre",{"className":424,"code":425,"language":426,"meta":427,"style":427},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","npm install @mionjs\u002Fplatform-cloudflare @mionjs\u002Frouter\n","bash","",[408,429,430],{"__ignoreMap":427},[431,432,435,439,443,446],"span",{"class":433,"line":434},"line",1,[431,436,438],{"class":437},"sBMFI","npm",[431,440,442],{"class":441},"sfazB"," install",[431,444,445],{"class":441}," @mionjs\u002Fplatform-cloudflare",[431,447,448],{"class":441}," @mionjs\u002Frouter\n",[417,450,452],{"id":451},"creating-the-handler","Creating the Handler",[454,455,456,534],"code-group",{},[422,457,462],{"className":458,"code":459,"filename":460,"language":461,"meta":427,"style":427},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import {createCloudflareHandler} from '@mionjs\u002Fplatform-cloudflare';\nimport '.\u002Fcloudflare-routes.ts';\n\nexport default createCloudflareHandler();\n","src\u002Findex.ts","ts",[408,463,464,495,509,516],{"__ignoreMap":427},[431,465,466,470,474,478,481,484,487,489,492],{"class":433,"line":434},[431,467,469],{"class":468},"s7zQu","import",[431,471,473],{"class":472},"sMK4o"," {",[431,475,477],{"class":476},"sTEyZ","createCloudflareHandler",[431,479,480],{"class":472},"}",[431,482,483],{"class":468}," from",[431,485,486],{"class":472}," '",[431,488,410],{"class":441},[431,490,491],{"class":472},"'",[431,493,494],{"class":472},";\n",[431,496,498,500,502,505,507],{"class":433,"line":497},2,[431,499,469],{"class":468},[431,501,486],{"class":472},[431,503,504],{"class":441},".\u002Fcloudflare-routes.ts",[431,506,491],{"class":472},[431,508,494],{"class":472},[431,510,512],{"class":433,"line":511},3,[431,513,515],{"emptyLinePlaceholder":514},true,"\n",[431,517,519,522,525,529,532],{"class":433,"line":518},4,[431,520,521],{"class":468},"export",[431,523,524],{"class":468}," default",[431,526,528],{"class":527},"s2Zo4"," createCloudflareHandler",[431,530,531],{"class":476},"()",[431,533,494],{"class":472},[422,535,538],{"className":458,"code":536,"filename":537,"language":461,"meta":427,"style":427},"import {createMionRouter, Routes} from '@mionjs\u002Frouter';\n\nconst mion = createMionRouter();\n\nconst routes = {\n  sayHello: mion.route((ctx, name: string): string => {\n    return `Hello ${name}!`;\n  }),\n} satisfies Routes;\n\n\u002F\u002F the server entry only imports this file\nexport const myApi = mion.initRoutes(routes);\nexport type MyApi = typeof myApi;\n","src\u002Froutes.ts",[408,539,540,568,572,591,595,608,656,684,696,708,713,720,745],{"__ignoreMap":427},[431,541,542,544,546,549,552,555,557,559,561,564,566],{"class":433,"line":434},[431,543,469],{"class":468},[431,545,473],{"class":472},[431,547,548],{"class":476},"createMionRouter",[431,550,551],{"class":472},",",[431,553,554],{"class":476}," Routes",[431,556,480],{"class":472},[431,558,483],{"class":468},[431,560,486],{"class":472},[431,562,563],{"class":441},"@mionjs\u002Frouter",[431,565,491],{"class":472},[431,567,494],{"class":472},[431,569,570],{"class":433,"line":497},[431,571,515],{"emptyLinePlaceholder":514},[431,573,574,578,581,584,587,589],{"class":433,"line":511},[431,575,577],{"class":576},"spNyl","const",[431,579,580],{"class":476}," mion ",[431,582,583],{"class":472},"=",[431,585,586],{"class":527}," createMionRouter",[431,588,531],{"class":476},[431,590,494],{"class":472},[431,592,593],{"class":433,"line":518},[431,594,515],{"emptyLinePlaceholder":514},[431,596,598,600,603,605],{"class":433,"line":597},5,[431,599,577],{"class":576},[431,601,602],{"class":476}," routes ",[431,604,583],{"class":472},[431,606,607],{"class":472}," {\n",[431,609,611,615,618,621,624,627,630,632,636,638,641,643,646,649,651,654],{"class":433,"line":610},6,[431,612,614],{"class":613},"swJcz","  sayHello",[431,616,617],{"class":472},":",[431,619,620],{"class":476}," mion",[431,622,623],{"class":472},".",[431,625,626],{"class":527},"route",[431,628,629],{"class":476},"(",[431,631,629],{"class":472},[431,633,635],{"class":634},"sHdIc","ctx",[431,637,551],{"class":472},[431,639,640],{"class":634}," name",[431,642,617],{"class":472},[431,644,645],{"class":437}," string",[431,647,648],{"class":472},"):",[431,650,645],{"class":437},[431,652,653],{"class":576}," =>",[431,655,607],{"class":472},[431,657,659,662,665,668,671,674,676,679,682],{"class":433,"line":658},7,[431,660,661],{"class":468},"    return",[431,663,664],{"class":472}," `",[431,666,667],{"class":441},"Hello ",[431,669,670],{"class":472},"${",[431,672,673],{"class":476},"name",[431,675,480],{"class":472},[431,677,678],{"class":441},"!",[431,680,681],{"class":472},"`",[431,683,494],{"class":472},[431,685,687,690,693],{"class":433,"line":686},8,[431,688,689],{"class":472},"  }",[431,691,692],{"class":476},")",[431,694,695],{"class":472},",\n",[431,697,699,701,704,706],{"class":433,"line":698},9,[431,700,480],{"class":472},[431,702,703],{"class":468}," satisfies",[431,705,554],{"class":437},[431,707,494],{"class":472},[431,709,711],{"class":433,"line":710},10,[431,712,515],{"emptyLinePlaceholder":514},[431,714,716],{"class":433,"line":715},11,[431,717,719],{"class":718},"sHwdD","\u002F\u002F the server entry only imports this file\n",[431,721,723,725,728,731,733,735,737,740,743],{"class":433,"line":722},12,[431,724,521],{"class":468},[431,726,727],{"class":576}," const",[431,729,730],{"class":476}," myApi ",[431,732,583],{"class":472},[431,734,620],{"class":476},[431,736,623],{"class":472},[431,738,739],{"class":527},"initRoutes",[431,741,742],{"class":476},"(routes)",[431,744,494],{"class":472},[431,746,748,750,753,756,759,762,765],{"class":433,"line":747},13,[431,749,521],{"class":468},[431,751,752],{"class":576}," type",[431,754,755],{"class":437}," MyApi",[431,757,758],{"class":472}," =",[431,760,761],{"class":472}," typeof",[431,763,764],{"class":476}," myApi",[431,766,494],{"class":472},[417,768,770],{"id":769},"cloudflare-configuration","Cloudflare Configuration",[405,772,773,774,777,778,781,782,786,787,790],{},"A minimal ",[408,775,776],{},"wrangler.toml"," for a mion Worker, where ",[408,779,780],{},"main"," points to the ",[783,784,147],"a",{"href":785},"#vite-configuration"," bundle. Run ",[408,788,789],{},"wrangler deploy"," to publish.",[422,792,796],{"className":793,"code":794,"language":795,"meta":427,"style":427},"language-toml shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","name = \"my-mion-api\"\nmain = \"dist\u002Fworker.js\"\ncompatibility_date = \"2024-01-01\"\n","toml",[408,797,798,803,808],{"__ignoreMap":427},[431,799,800],{"class":433,"line":434},[431,801,802],{},"name = \"my-mion-api\"\n",[431,804,805],{"class":433,"line":497},[431,806,807],{},"main = \"dist\u002Fworker.js\"\n",[431,809,810],{"class":433,"line":511},[431,811,812],{},"compatibility_date = \"2024-01-01\"\n",[417,814,816],{"id":815},"handler-options","Handler Options",[405,818,819,820,823,824,827,828,830,831,833,834,837,838,840,841,846,847,851],{},"Pass options such as ",[408,821,822],{},"maxBodySize"," (128 KB by default) and ",[408,825,826],{},"maxBodySizeCap"," to ",[408,829,477],{},". ",[408,832,826],{}," defaults to the 100 MB Cloudflare allows on the Free and Pro plans; override it on Business or Enterprise, which allow more. The handler's ",[408,835,836],{},"basePath"," strips a URL prefix before routing. Router options, including the router's own ",[408,839,836],{},", go in ",[783,842,844],{"href":843},"\u002Frpc\u002Fserver\u002Froutes#creating-the-router",[408,845,548],{},". Each route has its own ",[783,848,850],{"href":849},"\u002Frpc\u002Fserver\u002Froutes#request-size","body limit",", and a streamed body is cancelled with a 413 the moment it passes it.",[422,853,855],{"className":458,"code":854,"language":461,"meta":427,"style":427},"import {createCloudflareHandler} from '@mionjs\u002Fplatform-cloudflare';\nimport '.\u002Fcloudflare-routes.ts';\n\nexport default createCloudflareHandler({\n  basePath: '\u002Fapi',\n  maxBodySize: 512 * 1024,\n});\n",[408,856,857,877,889,893,906,922,941],{"__ignoreMap":427},[431,858,859,861,863,865,867,869,871,873,875],{"class":433,"line":434},[431,860,469],{"class":468},[431,862,473],{"class":472},[431,864,477],{"class":476},[431,866,480],{"class":472},[431,868,483],{"class":468},[431,870,486],{"class":472},[431,872,410],{"class":441},[431,874,491],{"class":472},[431,876,494],{"class":472},[431,878,879,881,883,885,887],{"class":433,"line":497},[431,880,469],{"class":468},[431,882,486],{"class":472},[431,884,504],{"class":441},[431,886,491],{"class":472},[431,888,494],{"class":472},[431,890,891],{"class":433,"line":511},[431,892,515],{"emptyLinePlaceholder":514},[431,894,895,897,899,901,903],{"class":433,"line":518},[431,896,521],{"class":468},[431,898,524],{"class":468},[431,900,528],{"class":527},[431,902,629],{"class":476},[431,904,905],{"class":472},"{\n",[431,907,908,911,913,915,918,920],{"class":433,"line":597},[431,909,910],{"class":613},"  basePath",[431,912,617],{"class":472},[431,914,486],{"class":472},[431,916,917],{"class":441},"\u002Fapi",[431,919,491],{"class":472},[431,921,695],{"class":472},[431,923,924,927,929,933,936,939],{"class":433,"line":610},[431,925,926],{"class":613},"  maxBodySize",[431,928,617],{"class":472},[431,930,932],{"class":931},"sbssI"," 512",[431,934,935],{"class":472}," *",[431,937,938],{"class":931}," 1024",[431,940,695],{"class":472},[431,942,943,945,947],{"class":433,"line":658},[431,944,480],{"class":472},[431,946,692],{"class":476},[431,948,494],{"class":472},[950,951,952,953,956,957,959,960,963,964,967,968,971],"tip",{},"The handler puts ",[408,954,955],{},"env"," (your Worker bindings: KV, D1, R2, secrets, etc.) and ",[408,958,635],{}," (the Worker ",[408,961,962],{},"ExecutionContext"," with ",[408,965,966],{},"waitUntil","\u002F",[408,969,970],{},"passThroughOnException",") on the call context's platform context. Use it to read Worker bindings in your route handlers.",[417,973,975],{"id":974},"vite-configuration","Vite Configuration",[405,977,773,978,981,982,623],{},[408,979,980],{},"vite.config.ts"," for a Worker. The Worker entry needs no special setup beyond ",[783,983,452],{"href":984},"#creating-the-handler",[986,987,988,1011],"caution",{},[405,989,990,991,994,995,998,999,1003,1004,1007,1008,623],{},"Cloudflare Workers do not allow ",[408,992,993],{},"new Function()"," or ",[408,996,997],{},"eval()",", so a Worker build ",[1000,1001,1002],"strong",{},"must"," set\n",[408,1005,1006],{},"runTypes: {emitMode: 'both'}"," on the ",[783,1009,1010],{"href":148},"mion Vite plugin",[405,1012,1013,1014,1017,1018,1022,1023,1026,1027,1030,1031,830,1034,1037],{},"The default ",[408,1015,1016],{},"emitMode: 'code'"," ships each build-time compiled function as a ",[1019,1020,1021],"em",{},"source string"," that\n",[408,1024,1025],{},"new Function"," turns into a real function on first use, and ",[408,1028,1029],{},"mion.initRoutes"," fails on the first route\nwith ",[1019,1032,1033],{},"\"Code generation from strings disallowed for this context\"",[408,1035,1036],{},"'both'"," also ships the live function,\nso nothing is compiled at runtime or at cold start. The cost: roughly +30% raw bundle size, +15% gzipped.",[422,1039,1041],{"className":458,"code":1040,"filename":980,"language":461,"meta":427,"style":427},"import {defineConfig} from 'vite';\nimport {resolve} from 'path';\nimport {mionVitePlugin} from '@mionjs\u002Fdevtools\u002Fvite';\n\nexport default defineConfig({\n  plugins: [\n    mionVitePlugin({\n      tsConfig: resolve(__dirname, 'tsconfig.json'),\n      runTypes: {\n        \u002F\u002F required on Workers: no `new Function` at runtime\n        emitMode: 'both',\n      },\n    }),\n  ],\n  build: {\n    lib: {\n      entry: 'src\u002Findex.ts',\n      formats: ['es'],\n      fileName: 'worker',\n    },\n    rollupOptions: {\n      \u002F\u002F Workers do not support dynamic code splitting, so bundle everything into one file\n      output: {inlineDynamicImports: true},\n    },\n  },\n});\n",[408,1042,1043,1065,1087,1109,1113,1126,1136,1145,1171,1180,1185,1201,1206,1215,1223,1233,1243,1259,1282,1299,1305,1315,1321,1343,1348,1354],{"__ignoreMap":427},[431,1044,1045,1047,1049,1052,1054,1056,1058,1061,1063],{"class":433,"line":434},[431,1046,469],{"class":468},[431,1048,473],{"class":472},[431,1050,1051],{"class":476},"defineConfig",[431,1053,480],{"class":472},[431,1055,483],{"class":468},[431,1057,486],{"class":472},[431,1059,1060],{"class":441},"vite",[431,1062,491],{"class":472},[431,1064,494],{"class":472},[431,1066,1067,1069,1071,1074,1076,1078,1080,1083,1085],{"class":433,"line":497},[431,1068,469],{"class":468},[431,1070,473],{"class":472},[431,1072,1073],{"class":476},"resolve",[431,1075,480],{"class":472},[431,1077,483],{"class":468},[431,1079,486],{"class":472},[431,1081,1082],{"class":441},"path",[431,1084,491],{"class":472},[431,1086,494],{"class":472},[431,1088,1089,1091,1093,1096,1098,1100,1102,1105,1107],{"class":433,"line":511},[431,1090,469],{"class":468},[431,1092,473],{"class":472},[431,1094,1095],{"class":476},"mionVitePlugin",[431,1097,480],{"class":472},[431,1099,483],{"class":468},[431,1101,486],{"class":472},[431,1103,1104],{"class":441},"@mionjs\u002Fdevtools\u002Fvite",[431,1106,491],{"class":472},[431,1108,494],{"class":472},[431,1110,1111],{"class":433,"line":518},[431,1112,515],{"emptyLinePlaceholder":514},[431,1114,1115,1117,1119,1122,1124],{"class":433,"line":597},[431,1116,521],{"class":468},[431,1118,524],{"class":468},[431,1120,1121],{"class":527}," defineConfig",[431,1123,629],{"class":476},[431,1125,905],{"class":472},[431,1127,1128,1131,1133],{"class":433,"line":610},[431,1129,1130],{"class":613},"  plugins",[431,1132,617],{"class":472},[431,1134,1135],{"class":476}," [\n",[431,1137,1138,1141,1143],{"class":433,"line":658},[431,1139,1140],{"class":527},"    mionVitePlugin",[431,1142,629],{"class":476},[431,1144,905],{"class":472},[431,1146,1147,1150,1152,1155,1158,1160,1162,1165,1167,1169],{"class":433,"line":686},[431,1148,1149],{"class":613},"      tsConfig",[431,1151,617],{"class":472},[431,1153,1154],{"class":527}," resolve",[431,1156,1157],{"class":476},"(__dirname",[431,1159,551],{"class":472},[431,1161,486],{"class":472},[431,1163,1164],{"class":441},"tsconfig.json",[431,1166,491],{"class":472},[431,1168,692],{"class":476},[431,1170,695],{"class":472},[431,1172,1173,1176,1178],{"class":433,"line":698},[431,1174,1175],{"class":613},"      runTypes",[431,1177,617],{"class":472},[431,1179,607],{"class":472},[431,1181,1182],{"class":433,"line":710},[431,1183,1184],{"class":718},"        \u002F\u002F required on Workers: no `new Function` at runtime\n",[431,1186,1187,1190,1192,1194,1197,1199],{"class":433,"line":715},[431,1188,1189],{"class":613},"        emitMode",[431,1191,617],{"class":472},[431,1193,486],{"class":472},[431,1195,1196],{"class":441},"both",[431,1198,491],{"class":472},[431,1200,695],{"class":472},[431,1202,1203],{"class":433,"line":722},[431,1204,1205],{"class":472},"      },\n",[431,1207,1208,1211,1213],{"class":433,"line":747},[431,1209,1210],{"class":472},"    }",[431,1212,692],{"class":476},[431,1214,695],{"class":472},[431,1216,1218,1221],{"class":433,"line":1217},14,[431,1219,1220],{"class":476},"  ]",[431,1222,695],{"class":472},[431,1224,1226,1229,1231],{"class":433,"line":1225},15,[431,1227,1228],{"class":613},"  build",[431,1230,617],{"class":472},[431,1232,607],{"class":472},[431,1234,1236,1239,1241],{"class":433,"line":1235},16,[431,1237,1238],{"class":613},"    lib",[431,1240,617],{"class":472},[431,1242,607],{"class":472},[431,1244,1246,1249,1251,1253,1255,1257],{"class":433,"line":1245},17,[431,1247,1248],{"class":613},"      entry",[431,1250,617],{"class":472},[431,1252,486],{"class":472},[431,1254,460],{"class":441},[431,1256,491],{"class":472},[431,1258,695],{"class":472},[431,1260,1262,1265,1267,1270,1272,1275,1277,1280],{"class":433,"line":1261},18,[431,1263,1264],{"class":613},"      formats",[431,1266,617],{"class":472},[431,1268,1269],{"class":476}," [",[431,1271,491],{"class":472},[431,1273,1274],{"class":441},"es",[431,1276,491],{"class":472},[431,1278,1279],{"class":476},"]",[431,1281,695],{"class":472},[431,1283,1285,1288,1290,1292,1295,1297],{"class":433,"line":1284},19,[431,1286,1287],{"class":613},"      fileName",[431,1289,617],{"class":472},[431,1291,486],{"class":472},[431,1293,1294],{"class":441},"worker",[431,1296,491],{"class":472},[431,1298,695],{"class":472},[431,1300,1302],{"class":433,"line":1301},20,[431,1303,1304],{"class":472},"    },\n",[431,1306,1308,1311,1313],{"class":433,"line":1307},21,[431,1309,1310],{"class":613},"    rollupOptions",[431,1312,617],{"class":472},[431,1314,607],{"class":472},[431,1316,1318],{"class":433,"line":1317},22,[431,1319,1320],{"class":718},"      \u002F\u002F Workers do not support dynamic code splitting, so bundle everything into one file\n",[431,1322,1324,1327,1329,1331,1334,1336,1340],{"class":433,"line":1323},23,[431,1325,1326],{"class":613},"      output",[431,1328,617],{"class":472},[431,1330,473],{"class":472},[431,1332,1333],{"class":613},"inlineDynamicImports",[431,1335,617],{"class":472},[431,1337,1339],{"class":1338},"sfNiH"," true",[431,1341,1342],{"class":472},"},\n",[431,1344,1346],{"class":433,"line":1345},24,[431,1347,1304],{"class":472},[431,1349,1351],{"class":433,"line":1350},25,[431,1352,1353],{"class":472},"  },\n",[431,1355,1357,1359,1361],{"class":433,"line":1356},26,[431,1358,480],{"class":472},[431,1360,692],{"class":476},[431,1362,494],{"class":472},[1364,1365],"spacer",{},[417,1367,1369],{"id":1368},"cloudflare-databases","Cloudflare Databases",[405,1371,1372,1373,623],{},"Cloudflare's two SQLite databases, D1 and Durable Objects storage, both work with the SQLite table package. Declare the table once and pick the driver where you connect, see ",[783,1374,329],{"href":330},[1376,1377,1378],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}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 .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}","Running mion APIs on Cloudflare Workers using the Web standard fetch handler.","md",null,{"toc":24},{"title":125,"description":1379},"YSZOqbsyM4IYK4Zo3q8Zvjr9DHwjuNbTeDyK9CVggTw",1793324370870]