[{"data":1,"prerenderedAt":1092},["ShallowReactive",2],{"navigation":3,"examples-nav":402,"-examples-middleware":503,"-examples-middleware-surround":1089},[4,93,226,232,387,399],{"title":5,"path":6,"stem":7,"children":8,"icon":92},"","/docs","1.docs/1.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","/docs/quick-start","1.docs/2.quick-start","i-lucide-zap",{"title":18,"path":19,"stem":20,"icon":21},"Renderer","/docs/renderer","1.docs/4.renderer","ri:layout-masonry-line",{"title":23,"path":24,"stem":25,"icon":26},"Routing","/docs/routing","1.docs/5.routing","ri:direction-line",{"title":28,"path":29,"stem":30,"icon":31},"Assets","/docs/assets","1.docs/50.assets","ri:image-2-line",{"title":33,"path":34,"stem":35,"icon":36},"Configuration","/docs/configuration","1.docs/50.configuration","ri:settings-3-line",{"title":38,"path":39,"stem":40,"icon":41},"Database","/docs/database","1.docs/50.database","ri:database-2-line",{"title":43,"path":44,"stem":45,"icon":46},"Lifecycle","/docs/lifecycle","1.docs/50.lifecycle","i-lucide-layers",{"title":48,"path":49,"stem":50,"icon":51},"OpenAPI","/docs/openapi","1.docs/50.openapi","ri:contract-line",{"title":53,"path":54,"stem":55,"icon":56},"Plugins","/docs/plugins","1.docs/50.plugins","ri:plug-line",{"title":58,"path":59,"stem":60,"icon":61},"Tasks","/docs/tasks","1.docs/50.tasks","codicon:run-all",{"title":63,"path":64,"stem":65,"icon":66},"WebSocket","/docs/websocket","1.docs/50.websocket","ri:broadcast-fill",{"title":68,"path":69,"stem":70,"icon":71},"Server Entry","/docs/server-entry","1.docs/6.server-entry","ri:server-line",{"title":73,"path":74,"stem":75,"icon":76},"Cache","/docs/cache","1.docs/7.cache","ri:speed-line",{"title":78,"path":79,"stem":80,"icon":81},"KV Storage","/docs/storage","1.docs/8.storage","carbon:datastore",{"title":83,"path":84,"stem":85,"icon":86},"Migration Guide","/docs/migration","1.docs/99.migration","ri:arrow-right-up-line",{"title":88,"path":89,"stem":90,"icon":91},"Nightly Channel","/docs/nightly","1.docs/99.nightly","ri:moon-fill","i-lucide-book-open",{"title":94,"path":95,"stem":96,"children":97,"icon":99},"Deploy","/deploy","2.deploy/0.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","/deploy/runtimes","2.deploy/10.runtimes",[105,110,115],{"title":106,"path":107,"stem":108,"icon":109},"Node.js","/deploy/runtimes/node","2.deploy/10.runtimes/1.node","akar-icons:node-fill",{"title":111,"path":112,"stem":113,"icon":114},"Bun","/deploy/runtimes/bun","2.deploy/10.runtimes/bun","simple-icons:bun",{"title":116,"path":117,"stem":118,"icon":119},"Deno","/deploy/runtimes/deno","2.deploy/10.runtimes/deno","simple-icons:deno",false,{"title":122,"path":123,"stem":124,"children":125,"page":120},"Providers","/deploy/providers","2.deploy/20.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","/deploy/providers/alwaysdata","2.deploy/20.providers/alwaysdata",{"title":131,"path":132,"stem":133},"AWS Lambda","/deploy/providers/aws","2.deploy/20.providers/aws",{"title":135,"path":136,"stem":137},"AWS Amplify","/deploy/providers/aws-amplify","2.deploy/20.providers/aws-amplify",{"title":139,"path":140,"stem":141},"Azure","/deploy/providers/azure","2.deploy/20.providers/azure",{"title":143,"path":144,"stem":145},"Cleavr","/deploy/providers/cleavr","2.deploy/20.providers/cleavr",{"title":147,"path":148,"stem":149},"Cloudflare","/deploy/providers/cloudflare","2.deploy/20.providers/cloudflare",{"title":151,"path":152,"stem":153},"Deno Deploy","/deploy/providers/deno-deploy","2.deploy/20.providers/deno-deploy",{"title":155,"path":156,"stem":157},"DigitalOcean","/deploy/providers/digitalocean","2.deploy/20.providers/digitalocean",{"title":159,"path":160,"stem":161},"EdgeOne Pages","/deploy/providers/edgeone","2.deploy/20.providers/edgeone",{"title":163,"path":164,"stem":165},"Firebase","/deploy/providers/firebase","2.deploy/20.providers/firebase",{"title":167,"path":168,"stem":169},"Flightcontrol","/deploy/providers/flightcontrol","2.deploy/20.providers/flightcontrol",{"title":171,"path":172,"stem":173},"Genezio","/deploy/providers/genezio","2.deploy/20.providers/genezio",{"title":175,"path":176,"stem":177},"GitHub Pages","/deploy/providers/github-pages","2.deploy/20.providers/github-pages",{"title":179,"path":180,"stem":181},"GitLab Pages","/deploy/providers/gitlab-pages","2.deploy/20.providers/gitlab-pages",{"title":183,"path":184,"stem":185},"Heroku","/deploy/providers/heroku","2.deploy/20.providers/heroku",{"title":187,"path":188,"stem":189},"IIS","/deploy/providers/iis","2.deploy/20.providers/iis",{"title":191,"path":192,"stem":193},"Koyeb","/deploy/providers/koyeb","2.deploy/20.providers/koyeb",{"title":195,"path":196,"stem":197},"Netlify","/deploy/providers/netlify","2.deploy/20.providers/netlify",{"title":199,"path":200,"stem":201},"Platform.sh","/deploy/providers/platform-sh","2.deploy/20.providers/platform-sh",{"title":203,"path":204,"stem":205},"Render.com","/deploy/providers/render","2.deploy/20.providers/render",{"title":207,"path":208,"stem":209},"StormKit","/deploy/providers/stormkit","2.deploy/20.providers/stormkit",{"title":211,"path":212,"stem":213},"Vercel","/deploy/providers/vercel","2.deploy/20.providers/vercel",{"title":215,"path":216,"stem":217},"Zeabur","/deploy/providers/zeabur","2.deploy/20.providers/zeabur",{"title":219,"path":220,"stem":221},"Zephyr Cloud","/deploy/providers/zephyr","2.deploy/20.providers/zephyr",{"title":223,"path":224,"stem":225},"Zerops","/deploy/providers/zerops","2.deploy/20.providers/zerops",{"title":227,"path":228,"stem":229,"children":230,"icon":36},"Config","/config","3.config/0.index",[231],{"title":227,"path":228,"stem":229,"icon":36},{"title":233,"path":234,"stem":235,"children":236,"icon":238},"Examples","/examples","4.examples/0.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","/examples/api-routes","4.examples/api-routes","i-lucide-route",{"title":245,"path":246,"stem":247,"icon":248},"Auto Imports","/examples/auto-imports","4.examples/auto-imports","i-lucide-import",{"title":250,"path":251,"stem":252,"icon":253},"Cached Handler","/examples/cached-handler","4.examples/cached-handler","i-lucide-clock",{"title":255,"path":256,"stem":257,"icon":258},"Custom Error Handler","/examples/custom-error-handler","4.examples/custom-error-handler","i-lucide-alert-circle",{"title":38,"path":260,"stem":261,"icon":262},"/examples/database","4.examples/database","i-lucide-database",{"title":264,"path":265,"stem":266,"icon":267},"Elysia","/examples/elysia","4.examples/elysia","i-skill-icons-elysia-dark",{"title":269,"path":270,"stem":271,"icon":272},"Express","/examples/express","4.examples/express","i-simple-icons-express",{"title":274,"path":275,"stem":276,"icon":277},"Fastify","/examples/fastify","4.examples/fastify","i-simple-icons-fastify",{"title":279,"path":280,"stem":281,"icon":282},"Hello World","/examples/hello-world","4.examples/hello-world","i-lucide-sparkles",{"title":284,"path":285,"stem":286,"icon":287},"Hono","/examples/hono","4.examples/hono","i-logos-hono",{"title":289,"path":290,"stem":291,"icon":292},"Import Alias","/examples/import-alias","4.examples/import-alias","i-lucide-at-sign",{"title":294,"path":295,"stem":296,"icon":46},"Middleware","/examples/middleware","4.examples/middleware",{"title":298,"path":299,"stem":300,"icon":301},"Mono JSX","/examples/mono-jsx","4.examples/mono-jsx","i-lucide-brackets",{"title":303,"path":304,"stem":305,"icon":301},"Nano JSX","/examples/nano-jsx","4.examples/nano-jsx",{"title":53,"path":307,"stem":308,"icon":309},"/examples/plugins","4.examples/plugins","i-lucide-plug",{"title":311,"path":312,"stem":313,"icon":314},"Custom Renderer","/examples/renderer","4.examples/renderer","i-lucide-code",{"title":316,"path":317,"stem":318,"icon":319},"Runtime Config","/examples/runtime-config","4.examples/runtime-config","i-lucide-settings",{"title":321,"path":322,"stem":323,"icon":324},"Server Fetch","/examples/server-fetch","4.examples/server-fetch","i-lucide-arrow-right-left",{"title":326,"path":327,"stem":328,"icon":329},"Shiki","/examples/shiki","4.examples/shiki","i-lucide-highlighter",{"title":331,"path":332,"stem":333,"icon":334},"Virtual Routes","/examples/virtual-routes","4.examples/virtual-routes","i-lucide-box",{"title":336,"path":337,"stem":338,"icon":339},"Vite Nitro Plugin","/examples/vite-nitro-plugin","4.examples/vite-nitro-plugin","i-logos-vitejs",{"title":341,"path":342,"stem":343,"icon":344},"Vite RSC","/examples/vite-rsc","4.examples/vite-rsc","i-logos-react",{"title":346,"path":347,"stem":348,"icon":349},"Vite SSR HTML","/examples/vite-ssr-html","4.examples/vite-ssr-html","i-logos-html-5",{"title":351,"path":352,"stem":353,"icon":354},"SSR with Preact","/examples/vite-ssr-preact","4.examples/vite-ssr-preact","i-logos-preact",{"title":356,"path":357,"stem":358,"icon":344},"SSR with React","/examples/vite-ssr-react","4.examples/vite-ssr-react",{"title":360,"path":361,"stem":362,"icon":363},"SSR with SolidJS","/examples/vite-ssr-solid","4.examples/vite-ssr-solid","i-logos-solidjs-icon",{"title":365,"path":366,"stem":367,"icon":368},"SSR with TanStack Router","/examples/vite-ssr-tsr-react","4.examples/vite-ssr-tsr-react","i-simple-icons-tanstack",{"title":370,"path":371,"stem":372,"icon":368},"SSR with TanStack Start","/examples/vite-ssr-tss-react","4.examples/vite-ssr-tss-react",{"title":374,"path":375,"stem":376,"icon":377},"SSR with Vue Router","/examples/vite-ssr-vue-router","4.examples/vite-ssr-vue-router","i-logos-vue",{"title":379,"path":380,"stem":381,"icon":382},"Vite + tRPC","/examples/vite-trpc","4.examples/vite-trpc","i-simple-icons-trpc",{"title":63,"path":384,"stem":385,"icon":386},"/examples/websocket","4.examples/websocket","i-lucide-radio",{"title":388,"path":389,"stem":390,"children":391},"Blog","/blog","9.blog",[392,395],{"title":388,"path":389,"stem":393,"icon":394},"9.blog/index","i-lucide-file-text",{"title":396,"path":397,"stem":398,"icon":394},"Nitro v3 Beta is here!","/blog/v3-beta","9.blog/1.v3-beta",{"title":5,"path":400,"stem":401},"/","index",[403,408,412,415,418,421,425,428,431,434,437,440,443,447,450,453,456,459,462,466,469,473,476,479,482,485,488,491,494,497,500],{"title":240,"description":404,"meta":405,"path":241},"File-based API routing with HTTP method support and dynamic parameters.",{"automd":406,"category":407,"icon":243},true,"features",{"title":245,"description":409,"meta":410,"path":246},"Automatic imports for utilities and composables.",{"automd":406,"category":411,"icon":248},"config",{"title":250,"description":413,"meta":414,"path":251},"Cache route responses with configurable bypass logic.",{"automd":406,"category":407,"icon":253},{"title":255,"description":416,"meta":417,"path":256},"Customize error responses with a global error handler.",{"automd":406,"category":407,"icon":258},{"title":38,"description":419,"meta":420,"path":260},"Built-in database support with SQL template literals.",{"automd":406,"category":407,"icon":262},{"title":264,"description":422,"meta":423,"path":265},"Integrate Elysia with Nitro using the server entry.",{"automd":406,"category":424,"icon":267},"backend frameworks",{"title":269,"description":426,"meta":427,"path":270},"Integrate Express with Nitro using the server entry.",{"automd":406,"category":424,"icon":272},{"title":274,"description":429,"meta":430,"path":275},"Integrate Fastify with Nitro using the server entry.",{"automd":406,"category":424,"icon":277},{"title":279,"description":432,"meta":433,"path":280},"Minimal Nitro server using the web standard fetch handler.",{"automd":406,"category":407,"icon":282},{"title":284,"description":435,"meta":436,"path":285},"Integrate Hono with Nitro using the server entry.",{"automd":406,"category":424,"icon":287},{"title":289,"description":438,"meta":439,"path":290},"Custom import aliases for cleaner module paths.",{"automd":406,"category":411,"icon":292},{"title":294,"description":441,"meta":442,"path":295},"Request middleware for authentication, logging, and request modification.",{"automd":406,"category":407,"icon":46},{"title":298,"description":444,"meta":445,"path":299},"Server-side JSX rendering in Nitro with mono-jsx.",{"automd":406,"category":446,"icon":301},"server side rendering",{"title":303,"description":448,"meta":449,"path":304},"Server-side JSX rendering in Nitro with nano-jsx.",{"automd":406,"category":446,"icon":301},{"title":53,"description":451,"meta":452,"path":307},"Extend Nitro with custom plugins for hooks and lifecycle events.",{"automd":406,"category":407,"icon":309},{"title":311,"description":454,"meta":455,"path":312},"Build a custom HTML renderer in Nitro with server-side data fetching.",{"automd":406,"category":446,"icon":314},{"title":316,"description":457,"meta":458,"path":317},"Environment-aware configuration with runtime access.",{"automd":406,"category":411,"icon":319},{"title":321,"description":460,"meta":461,"path":322},"Internal server-to-server requests without network overhead.",{"automd":406,"category":407,"icon":324},{"title":326,"description":463,"meta":464,"path":327},"Server-side syntax highlighting in Nitro with Shiki.",{"automd":406,"category":465,"icon":329},"integrations",{"title":331,"description":467,"meta":468,"path":332},"Define routes programmatically using Nitro's virtual module system.",{"automd":406,"category":407,"icon":334},{"title":336,"description":470,"meta":471,"path":337},"Use Nitro as a Vite plugin for programmatic configuration.",{"automd":406,"category":472,"icon":339},"vite",{"title":341,"description":474,"meta":475,"path":342},"React Server Components with Vite and Nitro.",{"automd":406,"category":472,"icon":344},{"title":346,"description":477,"meta":478,"path":347},"Server-side rendering with vanilla HTML, Vite, and Nitro.",{"automd":406,"category":446,"icon":349},{"title":351,"description":480,"meta":481,"path":352},"Server-side rendering with Preact in Nitro using Vite.",{"automd":406,"category":446,"icon":354},{"title":356,"description":483,"meta":484,"path":357},"Server-side rendering with React in Nitro using Vite.",{"automd":406,"category":446,"icon":344},{"title":360,"description":486,"meta":487,"path":361},"Server-side rendering with SolidJS in Nitro using Vite.",{"automd":406,"category":446,"icon":363},{"title":365,"description":489,"meta":490,"path":366},"Client-side routing with TanStack Router in Nitro using Vite.",{"automd":406,"category":446,"icon":368},{"title":370,"description":492,"meta":493,"path":371},"Full-stack React with TanStack Start in Nitro using Vite.",{"automd":406,"category":446,"icon":368},{"title":374,"description":495,"meta":496,"path":375},"Server-side rendering with Vue Router in Nitro using Vite.",{"automd":406,"category":446,"icon":377},{"title":379,"description":498,"meta":499,"path":380},"End-to-end typesafe APIs with tRPC in Nitro using Vite.",{"automd":406,"category":472,"icon":382},{"title":63,"description":501,"meta":502,"path":384},"Real-time bidirectional communication with WebSocket support.",{"automd":406,"category":407,"icon":386},{"id":504,"title":294,"body":505,"description":441,"extension":1084,"meta":1085,"navigation":1086,"path":295,"seo":1087,"stem":296,"__hash__":1088},"content/4.examples/middleware.md",{"type":506,"value":507,"toc":1079,"icon":46},"minimark",[508,902,906,911,918,988,991,1008,1012,1018,1064,1068,1075],[509,510,513,586,679,737,761,815],"code-tree",{":expand-all":511,"default-value":512},"true","server/middleware/auth.ts",[514,515,520],"pre",{"className":516,"code":517,"filename":518,"language":519,"meta":5,"style":5},"language-ts shiki shiki-themes github-light github-dark github-dark","import { defineConfig } from \"nitro\";\n\nexport default defineConfig({\n  serverDir: true,\n});\n","nitro.config.ts","ts",[521,522,523,546,552,568,580],"code",{"__ignoreMap":5},[524,525,528,532,536,539,543],"span",{"class":526,"line":527},"line",1,[524,529,531],{"class":530},"so5gQ","import",[524,533,535],{"class":534},"slsVL"," { defineConfig } ",[524,537,538],{"class":530},"from",[524,540,542],{"class":541},"sfrk1"," \"nitro\"",[524,544,545],{"class":534},";\n",[524,547,549],{"class":526,"line":548},2,[524,550,551],{"emptyLinePlaceholder":406},"\n",[524,553,555,558,561,565],{"class":526,"line":554},3,[524,556,557],{"class":530},"export",[524,559,560],{"class":530}," default",[524,562,564],{"class":563},"shcOC"," defineConfig",[524,566,567],{"class":534},"({\n",[524,569,571,574,577],{"class":526,"line":570},4,[524,572,573],{"class":534},"  serverDir: ",[524,575,511],{"class":576},"suiK_",[524,578,579],{"class":534},",\n",[524,581,583],{"class":526,"line":582},5,[524,584,585],{"class":534},"});\n",[514,587,592],{"className":588,"code":589,"filename":590,"language":591,"meta":5,"style":5},"language-json shiki shiki-themes github-light github-dark github-dark","{\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"nitro dev\",\n    \"build\": \"nitro build\"\n  },\n  \"devDependencies\": {\n    \"nitro\": \"latest\"\n  }\n}\n","package.json","json",[521,593,594,599,612,620,632,642,648,656,667,673],{"__ignoreMap":5},[524,595,596],{"class":526,"line":527},[524,597,598],{"class":534},"{\n",[524,600,601,604,607,610],{"class":526,"line":548},[524,602,603],{"class":576},"  \"type\"",[524,605,606],{"class":534},": ",[524,608,609],{"class":541},"\"module\"",[524,611,579],{"class":534},[524,613,614,617],{"class":526,"line":554},[524,615,616],{"class":576},"  \"scripts\"",[524,618,619],{"class":534},": {\n",[524,621,622,625,627,630],{"class":526,"line":570},[524,623,624],{"class":576},"    \"dev\"",[524,626,606],{"class":534},[524,628,629],{"class":541},"\"nitro dev\"",[524,631,579],{"class":534},[524,633,634,637,639],{"class":526,"line":582},[524,635,636],{"class":576},"    \"build\"",[524,638,606],{"class":534},[524,640,641],{"class":541},"\"nitro build\"\n",[524,643,645],{"class":526,"line":644},6,[524,646,647],{"class":534},"  },\n",[524,649,651,654],{"class":526,"line":650},7,[524,652,653],{"class":576},"  \"devDependencies\"",[524,655,619],{"class":534},[524,657,659,662,664],{"class":526,"line":658},8,[524,660,661],{"class":576},"    \"nitro\"",[524,663,606],{"class":534},[524,665,666],{"class":541},"\"latest\"\n",[524,668,670],{"class":526,"line":669},9,[524,671,672],{"class":534},"  }\n",[524,674,676],{"class":526,"line":675},10,[524,677,678],{"class":534},"}\n",[514,680,683],{"className":516,"code":681,"filename":682,"language":519,"meta":5,"style":5},"import { defineHandler } from \"nitro\";\n\nexport default defineHandler((event) => ({\n  auth: event.context.auth,\n}));\n","server.ts",[521,684,685,698,702,727,732],{"__ignoreMap":5},[524,686,687,689,692,694,696],{"class":526,"line":527},[524,688,531],{"class":530},[524,690,691],{"class":534}," { defineHandler } ",[524,693,538],{"class":530},[524,695,542],{"class":541},[524,697,545],{"class":534},[524,699,700],{"class":526,"line":548},[524,701,551],{"emptyLinePlaceholder":406},[524,703,704,706,708,711,714,718,721,724],{"class":526,"line":554},[524,705,557],{"class":530},[524,707,560],{"class":530},[524,709,710],{"class":563}," defineHandler",[524,712,713],{"class":534},"((",[524,715,717],{"class":716},"sQHwn","event",[524,719,720],{"class":534},") ",[524,722,723],{"class":530},"=>",[524,725,726],{"class":534}," ({\n",[524,728,729],{"class":526,"line":570},[524,730,731],{"class":534},"  auth: event.context.auth,\n",[524,733,734],{"class":526,"line":582},[524,735,736],{"class":534},"}));\n",[514,738,741],{"className":588,"code":739,"filename":740,"language":591,"meta":5,"style":5},"{\n  \"extends\": \"nitro/tsconfig\"\n}\n","tsconfig.json",[521,742,743,747,757],{"__ignoreMap":5},[524,744,745],{"class":526,"line":527},[524,746,598],{"class":534},[524,748,749,752,754],{"class":526,"line":548},[524,750,751],{"class":576},"  \"extends\"",[524,753,606],{"class":534},[524,755,756],{"class":541},"\"nitro/tsconfig\"\n",[524,758,759],{"class":526,"line":554},[524,760,678],{"class":534},[514,762,765],{"className":516,"code":763,"filename":764,"language":519,"meta":5,"style":5},"import { defineConfig } from \"vite\";\nimport { nitro } from \"nitro/vite\";\n\nexport default defineConfig({ plugins: [nitro()] });\n","vite.config.ts",[521,766,767,780,794,798],{"__ignoreMap":5},[524,768,769,771,773,775,778],{"class":526,"line":527},[524,770,531],{"class":530},[524,772,535],{"class":534},[524,774,538],{"class":530},[524,776,777],{"class":541}," \"vite\"",[524,779,545],{"class":534},[524,781,782,784,787,789,792],{"class":526,"line":548},[524,783,531],{"class":530},[524,785,786],{"class":534}," { nitro } ",[524,788,538],{"class":530},[524,790,791],{"class":541}," \"nitro/vite\"",[524,793,545],{"class":534},[524,795,796],{"class":526,"line":554},[524,797,551],{"emptyLinePlaceholder":406},[524,799,800,802,804,806,809,812],{"class":526,"line":570},[524,801,557],{"class":530},[524,803,560],{"class":530},[524,805,564],{"class":563},[524,807,808],{"class":534},"({ plugins: [",[524,810,811],{"class":563},"nitro",[524,813,814],{"class":534},"()] });\n",[514,816,818],{"className":516,"code":817,"filename":512,"language":519,"meta":5,"style":5},"import { defineMiddleware } from \"nitro\";\n\nexport default defineMiddleware((event) => {\n  event.context.auth = { name: \"User \" + Math.round(Math.random() * 100) };\n});\n",[521,819,820,833,837,857,898],{"__ignoreMap":5},[524,821,822,824,827,829,831],{"class":526,"line":527},[524,823,531],{"class":530},[524,825,826],{"class":534}," { defineMiddleware } ",[524,828,538],{"class":530},[524,830,542],{"class":541},[524,832,545],{"class":534},[524,834,835],{"class":526,"line":548},[524,836,551],{"emptyLinePlaceholder":406},[524,838,839,841,843,846,848,850,852,854],{"class":526,"line":554},[524,840,557],{"class":530},[524,842,560],{"class":530},[524,844,845],{"class":563}," defineMiddleware",[524,847,713],{"class":534},[524,849,717],{"class":716},[524,851,720],{"class":534},[524,853,723],{"class":530},[524,855,856],{"class":534}," {\n",[524,858,859,862,865,868,871,874,877,880,883,886,889,892,895],{"class":526,"line":570},[524,860,861],{"class":534},"  event.context.auth ",[524,863,864],{"class":530},"=",[524,866,867],{"class":534}," { name: ",[524,869,870],{"class":541},"\"User \"",[524,872,873],{"class":530}," +",[524,875,876],{"class":534}," Math.",[524,878,879],{"class":563},"round",[524,881,882],{"class":534},"(Math.",[524,884,885],{"class":563},"random",[524,887,888],{"class":534},"() ",[524,890,891],{"class":530},"*",[524,893,894],{"class":576}," 100",[524,896,897],{"class":534},") };\n",[524,899,900],{"class":526,"line":582},[524,901,585],{"class":534},[903,904,905],"p",{},"Middleware functions run before route handlers on every request. They can modify the request, add context, or return early responses.",[907,908,910],"h2",{"id":909},"defining-middleware","Defining Middleware",[903,912,913,914,917],{},"Create files in ",[521,915,916],{},"server/middleware/",". They run in alphabetical order:",[514,919,920],{"className":516,"code":817,"filename":512,"language":519,"meta":5,"style":5},[521,921,922,934,938,956,984],{"__ignoreMap":5},[524,923,924,926,928,930,932],{"class":526,"line":527},[524,925,531],{"class":530},[524,927,826],{"class":534},[524,929,538],{"class":530},[524,931,542],{"class":541},[524,933,545],{"class":534},[524,935,936],{"class":526,"line":548},[524,937,551],{"emptyLinePlaceholder":406},[524,939,940,942,944,946,948,950,952,954],{"class":526,"line":554},[524,941,557],{"class":530},[524,943,560],{"class":530},[524,945,845],{"class":563},[524,947,713],{"class":534},[524,949,717],{"class":716},[524,951,720],{"class":534},[524,953,723],{"class":530},[524,955,856],{"class":534},[524,957,958,960,962,964,966,968,970,972,974,976,978,980,982],{"class":526,"line":570},[524,959,861],{"class":534},[524,961,864],{"class":530},[524,963,867],{"class":534},[524,965,870],{"class":541},[524,967,873],{"class":530},[524,969,876],{"class":534},[524,971,879],{"class":563},[524,973,882],{"class":534},[524,975,885],{"class":563},[524,977,888],{"class":534},[524,979,891],{"class":530},[524,981,894],{"class":576},[524,983,897],{"class":534},[524,985,986],{"class":526,"line":582},[524,987,585],{"class":534},[903,989,990],{},"Middleware can:",[992,993,994,1002,1005],"ul",{},[995,996,997,998,1001],"li",{},"Add data to ",[521,999,1000],{},"event.context"," for use in handlers",[995,1003,1004],{},"Return a response early to short-circuit the request",[995,1006,1007],{},"Modify request headers or other properties",[907,1009,1011],{"id":1010},"accessing-context-in-handlers","Accessing Context in Handlers",[903,1013,1014,1015,1017],{},"Data added to ",[521,1016,1000],{}," in middleware is available in all subsequent handlers:",[514,1019,1020],{"className":516,"code":681,"filename":682,"language":519,"meta":5,"style":5},[521,1021,1022,1034,1038,1056,1060],{"__ignoreMap":5},[524,1023,1024,1026,1028,1030,1032],{"class":526,"line":527},[524,1025,531],{"class":530},[524,1027,691],{"class":534},[524,1029,538],{"class":530},[524,1031,542],{"class":541},[524,1033,545],{"class":534},[524,1035,1036],{"class":526,"line":548},[524,1037,551],{"emptyLinePlaceholder":406},[524,1039,1040,1042,1044,1046,1048,1050,1052,1054],{"class":526,"line":554},[524,1041,557],{"class":530},[524,1043,560],{"class":530},[524,1045,710],{"class":563},[524,1047,713],{"class":534},[524,1049,717],{"class":716},[524,1051,720],{"class":534},[524,1053,723],{"class":530},[524,1055,726],{"class":534},[524,1057,1058],{"class":526,"line":570},[524,1059,731],{"class":534},[524,1061,1062],{"class":526,"line":582},[524,1063,736],{"class":534},[907,1065,1067],{"id":1066},"learn-more","Learn More",[992,1069,1070],{},[995,1071,1072],{},[1073,1074,23],"a",{"href":24},[1076,1077,1078],"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}",{"title":5,"searchDepth":548,"depth":548,"links":1080},[1081,1082,1083],{"id":909,"depth":548,"text":910},{"id":1010,"depth":548,"text":1011},{"id":1066,"depth":548,"text":1067},"md",{"automd":406,"category":407,"icon":46},{"icon":46},{"title":294,"description":441},"nsjHMvqJUA8W0Ofu_tzeH9hzzNHIrXZG9o4cx5DcFqg",[1090,1091],{"title":289,"path":290,"stem":291,"description":438,"icon":292,"children":-1},{"title":298,"path":299,"stem":300,"description":444,"icon":301,"children":-1},1776367071769]