[{"data":1,"prerenderedAt":1499},["ShallowReactive",2],{"navigation":3,"-docs-lifecycle":394,"-docs-lifecycle-surround":1494},[4,88,217,223,379,391],{"title":5,"path":6,"stem":7,"children":8,"icon":87},"","/docs","1.docs/1.index",[9,12,17,22,27,32,37,42,47,52,57,62,67,72,77,82],{"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},"Server Entry","/docs/server-entry","1.docs/6.server-entry","ri:server-line",{"title":68,"path":69,"stem":70,"icon":71},"Cache","/docs/cache","1.docs/7.cache","ri:speed-line",{"title":73,"path":74,"stem":75,"icon":76},"KV Storage","/docs/storage","1.docs/8.storage","carbon:datastore",{"title":78,"path":79,"stem":80,"icon":81},"Migration Guide","/docs/migration","1.docs/99.migration","ri:arrow-right-up-line",{"title":83,"path":84,"stem":85,"icon":86},"Nightly Channel","/docs/nightly","1.docs/99.nightly","ri:moon-fill","i-lucide-book-open",{"title":89,"path":90,"stem":91,"children":92,"icon":94},"Deploy","/deploy","2.deploy/0.index",[93,95,116],{"title":89,"path":90,"stem":91,"icon":94},"ri:upload-cloud-2-line",{"title":96,"path":97,"stem":98,"children":99,"page":115},"Runtimes","/deploy/runtimes","2.deploy/10.runtimes",[100,105,110],{"title":101,"path":102,"stem":103,"icon":104},"Node.js","/deploy/runtimes/node","2.deploy/10.runtimes/1.node","akar-icons:node-fill",{"title":106,"path":107,"stem":108,"icon":109},"Bun","/deploy/runtimes/bun","2.deploy/10.runtimes/bun","simple-icons:bun",{"title":111,"path":112,"stem":113,"icon":114},"Deno","/deploy/runtimes/deno","2.deploy/10.runtimes/deno","simple-icons:deno",false,{"title":117,"path":118,"stem":119,"children":120,"page":115},"Providers","/deploy/providers","2.deploy/20.providers",[121,125,129,133,137,141,145,149,153,157,161,165,169,173,177,181,185,189,193,197,201,205,209,213],{"title":122,"path":123,"stem":124},"Alwaysdata","/deploy/providers/alwaysdata","2.deploy/20.providers/alwaysdata",{"title":126,"path":127,"stem":128},"AWS Lambda","/deploy/providers/aws","2.deploy/20.providers/aws",{"title":130,"path":131,"stem":132},"AWS Amplify","/deploy/providers/aws-amplify","2.deploy/20.providers/aws-amplify",{"title":134,"path":135,"stem":136},"Azure","/deploy/providers/azure","2.deploy/20.providers/azure",{"title":138,"path":139,"stem":140},"Cleavr","/deploy/providers/cleavr","2.deploy/20.providers/cleavr",{"title":142,"path":143,"stem":144},"Cloudflare","/deploy/providers/cloudflare","2.deploy/20.providers/cloudflare",{"title":146,"path":147,"stem":148},"Deno Deploy","/deploy/providers/deno-deploy","2.deploy/20.providers/deno-deploy",{"title":150,"path":151,"stem":152},"DigitalOcean","/deploy/providers/digitalocean","2.deploy/20.providers/digitalocean",{"title":154,"path":155,"stem":156},"Firebase","/deploy/providers/firebase","2.deploy/20.providers/firebase",{"title":158,"path":159,"stem":160},"Flightcontrol","/deploy/providers/flightcontrol","2.deploy/20.providers/flightcontrol",{"title":162,"path":163,"stem":164},"Genezio","/deploy/providers/genezio","2.deploy/20.providers/genezio",{"title":166,"path":167,"stem":168},"GitHub Pages","/deploy/providers/github-pages","2.deploy/20.providers/github-pages",{"title":170,"path":171,"stem":172},"GitLab Pages","/deploy/providers/gitlab-pages","2.deploy/20.providers/gitlab-pages",{"title":174,"path":175,"stem":176},"Heroku","/deploy/providers/heroku","2.deploy/20.providers/heroku",{"title":178,"path":179,"stem":180},"IIS","/deploy/providers/iis","2.deploy/20.providers/iis",{"title":182,"path":183,"stem":184},"Koyeb","/deploy/providers/koyeb","2.deploy/20.providers/koyeb",{"title":186,"path":187,"stem":188},"Netlify","/deploy/providers/netlify","2.deploy/20.providers/netlify",{"title":190,"path":191,"stem":192},"Platform.sh","/deploy/providers/platform-sh","2.deploy/20.providers/platform-sh",{"title":194,"path":195,"stem":196},"Render.com","/deploy/providers/render","2.deploy/20.providers/render",{"title":198,"path":199,"stem":200},"StormKit","/deploy/providers/stormkit","2.deploy/20.providers/stormkit",{"title":202,"path":203,"stem":204},"Vercel","/deploy/providers/vercel","2.deploy/20.providers/vercel",{"title":206,"path":207,"stem":208},"Zeabur","/deploy/providers/zeabur","2.deploy/20.providers/zeabur",{"title":210,"path":211,"stem":212},"Zephyr Cloud","/deploy/providers/zephyr","2.deploy/20.providers/zephyr",{"title":214,"path":215,"stem":216},"Zerops","/deploy/providers/zerops","2.deploy/20.providers/zerops",{"title":218,"path":219,"stem":220,"children":221,"icon":36},"Config","/config","3.config/0.index",[222],{"title":218,"path":219,"stem":220,"icon":36},{"title":224,"path":225,"stem":226,"children":227,"icon":229},"Examples","/examples","4.examples/0.index",[228,230,235,240,245,250,254,259,264,269,274,279,284,288,293,297,301,306,311,316,321,326,331,336,341,346,350,355,360,364,369,374],{"title":224,"path":225,"stem":226,"icon":229},"i-lucide-folder-code",{"title":231,"path":232,"stem":233,"icon":234},"API Routes","/examples/api-routes","4.examples/api-routes","i-lucide-route",{"title":236,"path":237,"stem":238,"icon":239},"Auto Imports","/examples/auto-imports","4.examples/auto-imports","i-lucide-import",{"title":241,"path":242,"stem":243,"icon":244},"Cached Handler","/examples/cached-handler","4.examples/cached-handler","i-lucide-clock",{"title":246,"path":247,"stem":248,"icon":249},"Custom Error Handler","/examples/custom-error-handler","4.examples/custom-error-handler","i-lucide-alert-circle",{"title":38,"path":251,"stem":252,"icon":253},"/examples/database","4.examples/database","i-lucide-database",{"title":255,"path":256,"stem":257,"icon":258},"Elysia","/examples/elysia","4.examples/elysia","i-skill-icons-elysia-dark",{"title":260,"path":261,"stem":262,"icon":263},"Express","/examples/express","4.examples/express","i-simple-icons-express",{"title":265,"path":266,"stem":267,"icon":268},"Fastify","/examples/fastify","4.examples/fastify","i-simple-icons-fastify",{"title":270,"path":271,"stem":272,"icon":273},"Hello World","/examples/hello-world","4.examples/hello-world","i-lucide-sparkles",{"title":275,"path":276,"stem":277,"icon":278},"Hono","/examples/hono","4.examples/hono","i-logos-hono",{"title":280,"path":281,"stem":282,"icon":283},"Import Alias","/examples/import-alias","4.examples/import-alias","i-lucide-at-sign",{"title":285,"path":286,"stem":287,"icon":46},"Middleware","/examples/middleware","4.examples/middleware",{"title":289,"path":290,"stem":291,"icon":292},"Mono JSX","/examples/mono-jsx","4.examples/mono-jsx","i-lucide-brackets",{"title":294,"path":295,"stem":296,"icon":292},"Nano JSX","/examples/nano-jsx","4.examples/nano-jsx",{"title":53,"path":298,"stem":299,"icon":300},"/examples/plugins","4.examples/plugins","i-lucide-plug",{"title":302,"path":303,"stem":304,"icon":305},"Custom Renderer","/examples/renderer","4.examples/renderer","i-lucide-code",{"title":307,"path":308,"stem":309,"icon":310},"Runtime Config","/examples/runtime-config","4.examples/runtime-config","i-lucide-settings",{"title":312,"path":313,"stem":314,"icon":315},"Server Fetch","/examples/server-fetch","4.examples/server-fetch","i-lucide-arrow-right-left",{"title":317,"path":318,"stem":319,"icon":320},"Shiki","/examples/shiki","4.examples/shiki","i-lucide-highlighter",{"title":322,"path":323,"stem":324,"icon":325},"Virtual Routes","/examples/virtual-routes","4.examples/virtual-routes","i-lucide-box",{"title":327,"path":328,"stem":329,"icon":330},"Vite Nitro Plugin","/examples/vite-nitro-plugin","4.examples/vite-nitro-plugin","i-logos-vitejs",{"title":332,"path":333,"stem":334,"icon":335},"Vite RSC","/examples/vite-rsc","4.examples/vite-rsc","i-logos-react",{"title":337,"path":338,"stem":339,"icon":340},"Vite SSR HTML","/examples/vite-ssr-html","4.examples/vite-ssr-html","i-logos-html-5",{"title":342,"path":343,"stem":344,"icon":345},"SSR with Preact","/examples/vite-ssr-preact","4.examples/vite-ssr-preact","i-logos-preact",{"title":347,"path":348,"stem":349,"icon":335},"SSR with React","/examples/vite-ssr-react","4.examples/vite-ssr-react",{"title":351,"path":352,"stem":353,"icon":354},"SSR with SolidJS","/examples/vite-ssr-solid","4.examples/vite-ssr-solid","i-logos-solidjs-icon",{"title":356,"path":357,"stem":358,"icon":359},"SSR with TanStack Router","/examples/vite-ssr-tsr-react","4.examples/vite-ssr-tsr-react","i-simple-icons-tanstack",{"title":361,"path":362,"stem":363,"icon":359},"SSR with TanStack Start","/examples/vite-ssr-tss-react","4.examples/vite-ssr-tss-react",{"title":365,"path":366,"stem":367,"icon":368},"SSR with Vue Router","/examples/vite-ssr-vue-router","4.examples/vite-ssr-vue-router","i-logos-vue",{"title":370,"path":371,"stem":372,"icon":373},"Vite + tRPC","/examples/vite-trpc","4.examples/vite-trpc","i-simple-icons-trpc",{"title":375,"path":376,"stem":377,"icon":378},"WebSocket","/examples/websocket","4.examples/websocket","i-lucide-radio",{"title":380,"path":381,"stem":382,"children":383},"Blog","/blog","9.blog",[384,387],{"title":380,"path":381,"stem":385,"icon":386},"9.blog/index","i-lucide-file-text",{"title":388,"path":389,"stem":390,"icon":386},"Nitro v3 Beta is here!","/blog/v3-beta","9.blog/1.v3-beta",{"title":5,"path":392,"stem":393},"/","index",{"id":395,"title":43,"body":396,"description":1488,"extension":1489,"meta":1490,"navigation":1491,"path":44,"seo":1492,"stem":45,"__hash__":1493},"content/1.docs/50.lifecycle.md",{"type":397,"value":398,"toc":1471,"icon":46},"minimark",[399,404,408,1080,1084,1087,1104,1205,1212,1215,1261,1274,1278,1285,1361,1365,1375,1454,1462,1467],[400,401,403],"h2",{"id":402},"request-lifecycle","Request lifecycle",[405,406,407],"p",{},"A request can be intercepted and terminated (with or without a response) from any of these layers, in this order:",[409,410,411,420,431,566,582,586,598,616,623,627,630,701,706,710,717,780,786,792,796,806,810,817,848,854,861,936,941,944,947,952,958,968,1073],"steps",{},[412,413,415,419],"h3",{"id":414},"request-hook",[416,417,418],"code",{},"request"," hook",[405,421,422,423,425,426,430],{},"The ",[416,424,418],{}," hook is the first code that runs for every incoming request. It is registered via a ",[427,428,429],"a",{"href":54},"server plugin",":",[432,433,438],"pre",{"className":434,"code":435,"filename":436,"language":437,"meta":5,"style":5},"language-ts shiki shiki-themes github-light github-dark github-dark","import { definePlugin } from \"nitro\";\n\nexport default definePlugin((nitroApp) => {\n  nitroApp.hooks.hook(\"request\", (event) => {\n    console.log(`Incoming request on ${event.path}`);\n  });\n});\n","plugins/request-hook.ts","ts",[416,439,440,463,470,499,526,554,560],{"__ignoreMap":5},[441,442,445,449,453,456,460],"span",{"class":443,"line":444},"line",1,[441,446,448],{"class":447},"so5gQ","import",[441,450,452],{"class":451},"slsVL"," { definePlugin } ",[441,454,455],{"class":447},"from",[441,457,459],{"class":458},"sfrk1"," \"nitro\"",[441,461,462],{"class":451},";\n",[441,464,466],{"class":443,"line":465},2,[441,467,469],{"emptyLinePlaceholder":468},true,"\n",[441,471,473,476,479,483,486,490,493,496],{"class":443,"line":472},3,[441,474,475],{"class":447},"export",[441,477,478],{"class":447}," default",[441,480,482],{"class":481},"shcOC"," definePlugin",[441,484,485],{"class":451},"((",[441,487,489],{"class":488},"sQHwn","nitroApp",[441,491,492],{"class":451},") ",[441,494,495],{"class":447},"=>",[441,497,498],{"class":451}," {\n",[441,500,502,505,508,511,514,517,520,522,524],{"class":443,"line":501},4,[441,503,504],{"class":451},"  nitroApp.hooks.",[441,506,507],{"class":481},"hook",[441,509,510],{"class":451},"(",[441,512,513],{"class":458},"\"request\"",[441,515,516],{"class":451},", (",[441,518,519],{"class":488},"event",[441,521,492],{"class":451},[441,523,495],{"class":447},[441,525,498],{"class":451},[441,527,529,532,535,537,540,542,545,548,551],{"class":443,"line":528},5,[441,530,531],{"class":451},"    console.",[441,533,534],{"class":481},"log",[441,536,510],{"class":451},[441,538,539],{"class":458},"`Incoming request on ${",[441,541,519],{"class":451},[441,543,544],{"class":458},".",[441,546,547],{"class":451},"path",[441,549,550],{"class":458},"}`",[441,552,553],{"class":451},");\n",[441,555,557],{"class":443,"line":556},6,[441,558,559],{"class":451},"  });\n",[441,561,563],{"class":443,"line":562},7,[441,564,565],{"class":451},"});\n",[567,568,569],"note",{},[405,570,571,572,574,575,581],{},"Errors thrown inside the ",[416,573,418],{}," hook are captured by the ",[427,576,578,419],{"href":577},"#error-handling",[416,579,580],{},"error"," and do not terminate the request pipeline.",[412,583,585],{"id":584},"static-assets","Static assets",[405,587,588,589,592,593,597],{},"When static asset serving is enabled (the default for most presets), Nitro checks if the request matches a file in the ",[416,590,591],{},"public/"," directory ",[594,595,596],"strong",{},"before"," any other middleware or route handler runs.",[405,599,600,601,604,605,604,608,611,612,615],{},"If a match is found, the static file is served immediately with appropriate ",[416,602,603],{},"Content-Type",", ",[416,606,607],{},"ETag",[416,609,610],{},"Last-Modified",", and ",[416,613,614],{},"Cache-Control"," headers. The request is terminated and no further middleware or routes are executed.",[405,617,618,619,622],{},"Static assets also support content negotiation for pre-compressed files (gzip, brotli, zstd) via the ",[416,620,621],{},"Accept-Encoding"," header.",[412,624,626],{"id":625},"route-rules","Route rules",[405,628,629],{},"The matching route rules defined in the Nitro config will execute. Route rules run as middleware so most of them alter the response without terminating it (for instance, adding a header or setting a cache policy).",[432,631,634],{"className":434,"code":632,"filename":633,"language":437,"meta":5,"style":5},"import { defineNitroConfig } from \"nitro/config\";\n\nexport default defineNitroConfig({\n  routeRules: {\n    '/**': { headers: { 'x-nitro': 'first' } }\n  }\n})\n","nitro.config.ts",[416,635,636,650,654,666,671,691,696],{"__ignoreMap":5},[441,637,638,640,643,645,648],{"class":443,"line":444},[441,639,448],{"class":447},[441,641,642],{"class":451}," { defineNitroConfig } ",[441,644,455],{"class":447},[441,646,647],{"class":458}," \"nitro/config\"",[441,649,462],{"class":451},[441,651,652],{"class":443,"line":465},[441,653,469],{"emptyLinePlaceholder":468},[441,655,656,658,660,663],{"class":443,"line":472},[441,657,475],{"class":447},[441,659,478],{"class":447},[441,661,662],{"class":481}," defineNitroConfig",[441,664,665],{"class":451},"({\n",[441,667,668],{"class":443,"line":501},[441,669,670],{"class":451},"  routeRules: {\n",[441,672,673,676,679,682,685,688],{"class":443,"line":528},[441,674,675],{"class":458},"    '/**'",[441,677,678],{"class":451},": { headers: { ",[441,680,681],{"class":458},"'x-nitro'",[441,683,684],{"class":451},": ",[441,686,687],{"class":458},"'first'",[441,689,690],{"class":451}," } }\n",[441,692,693],{"class":443,"line":556},[441,694,695],{"class":451},"  }\n",[441,697,698],{"class":443,"line":562},[441,699,700],{"class":451},"})\n",[702,703],"read-more",{"to":704,"title":705},"/docs/routing#route-rules","Routing > Route rules",[412,707,709],{"id":708},"global-middleware","Global middleware",[405,711,712,713,716],{},"Any global middleware defined in the ",[416,714,715],{},"middleware/"," directory will be run:",[432,718,721],{"className":434,"code":719,"filename":720,"language":437,"meta":5,"style":5},"import { defineHandler } from \"nitro\";\n\nexport default defineHandler((event) => {\n  event.context.info = { name: \"Nitro\" };\n});\n","middleware/info.ts",[416,722,723,736,740,759,776],{"__ignoreMap":5},[441,724,725,727,730,732,734],{"class":443,"line":444},[441,726,448],{"class":447},[441,728,729],{"class":451}," { defineHandler } ",[441,731,455],{"class":447},[441,733,459],{"class":458},[441,735,462],{"class":451},[441,737,738],{"class":443,"line":465},[441,739,469],{"emptyLinePlaceholder":468},[441,741,742,744,746,749,751,753,755,757],{"class":443,"line":472},[441,743,475],{"class":447},[441,745,478],{"class":447},[441,747,748],{"class":481}," defineHandler",[441,750,485],{"class":451},[441,752,519],{"class":488},[441,754,492],{"class":451},[441,756,495],{"class":447},[441,758,498],{"class":451},[441,760,761,764,767,770,773],{"class":443,"line":501},[441,762,763],{"class":451},"  event.context.info ",[441,765,766],{"class":447},"=",[441,768,769],{"class":451}," { name: ",[441,771,772],{"class":458},"\"Nitro\"",[441,774,775],{"class":451}," };\n",[441,777,778],{"class":443,"line":528},[441,779,565],{"class":451},[781,782,783],"warning",{},[405,784,785],{},"Returning from a middleware will close the request and should be avoided when possible.",[702,787,789],{"to":788},"/docs/routing#middleware",[405,790,791],{},"Learn more about Nitro middleware.",[412,793,795],{"id":794},"routed-middleware","Routed middleware",[405,797,798,799,802,803,805],{},"Middleware that targets a specific route pattern (defined with a ",[416,800,801],{},"route"," in ",[416,804,715],{},") runs after global middleware but before the matched route handler.",[412,807,809],{"id":808},"routes","Routes",[405,811,812,813,816],{},"Nitro will look at defined routes in the ",[416,814,815],{},"routes/"," folder to match the incoming request.",[432,818,821],{"className":434,"code":819,"filename":820,"language":437,"meta":5,"style":5},"export default (event) => ({ world: true })\n","routes/api/hello.ts",[416,822,823],{"__ignoreMap":5},[441,824,825,827,829,832,834,836,838,841,845],{"class":443,"line":444},[441,826,475],{"class":447},[441,828,478],{"class":447},[441,830,831],{"class":451}," (",[441,833,519],{"class":488},[441,835,492],{"class":451},[441,837,495],{"class":447},[441,839,840],{"class":451}," ({ world: ",[441,842,844],{"class":843},"suiK_","true",[441,846,847],{"class":451}," })\n",[702,849,851],{"to":850},"/docs/routing#filesystem-routing",[405,852,853],{},"Learn more about Nitro file-system routing.",[405,855,856,857,860],{},"If serverEntry is defined it will catch all requests not matching any other route acting as ",[416,858,859],{},"/**"," route handler.",[432,862,865],{"className":434,"code":863,"filename":864,"language":437,"meta":5,"style":5},"import { defineHandler } from \"nitro\";\n\nexport default defineHandler((event) => {\n  if (event.path === \"/\") {\n    return \"Home page\";\n  }\n});\n","server.ts",[416,866,867,879,883,901,918,928,932],{"__ignoreMap":5},[441,868,869,871,873,875,877],{"class":443,"line":444},[441,870,448],{"class":447},[441,872,729],{"class":451},[441,874,455],{"class":447},[441,876,459],{"class":458},[441,878,462],{"class":451},[441,880,881],{"class":443,"line":465},[441,882,469],{"emptyLinePlaceholder":468},[441,884,885,887,889,891,893,895,897,899],{"class":443,"line":472},[441,886,475],{"class":447},[441,888,478],{"class":447},[441,890,748],{"class":481},[441,892,485],{"class":451},[441,894,519],{"class":488},[441,896,492],{"class":451},[441,898,495],{"class":447},[441,900,498],{"class":451},[441,902,903,906,909,912,915],{"class":443,"line":501},[441,904,905],{"class":447},"  if",[441,907,908],{"class":451}," (event.path ",[441,910,911],{"class":447},"===",[441,913,914],{"class":458}," \"/\"",[441,916,917],{"class":451},") {\n",[441,919,920,923,926],{"class":443,"line":528},[441,921,922],{"class":447},"    return",[441,924,925],{"class":458}," \"Home page\"",[441,927,462],{"class":451},[441,929,930],{"class":443,"line":556},[441,931,695],{"class":451},[441,933,934],{"class":443,"line":562},[441,935,565],{"class":451},[702,937,938],{"to":64},[405,939,940],{},"Learn more about Nitro server entry.",[412,942,18],{"id":943},"renderer",[405,945,946],{},"If no route is matched, Nitro will look for a renderer handler (defined or auto-detected) to handle the request.",[702,948,949],{"to":19},[405,950,951],{},"Learn more about Nitro renderer.",[412,953,955,419],{"id":954},"response-hook",[416,956,957],{},"response",[405,959,960,961,963,964,967],{},"After the response is created (from any of the layers above), the ",[416,962,957],{}," hook runs. This hook receives the final ",[416,965,966],{},"Response"," object and the event, and can be used to inspect or modify response headers:",[432,969,972],{"className":434,"code":970,"filename":971,"language":437,"meta":5,"style":5},"import { definePlugin } from \"nitro\";\n\nexport default definePlugin((nitroApp) => {\n  nitroApp.hooks.hook(\"response\", (res, event) => {\n    console.log(`Response ${res.status} for ${event.path}`);\n  });\n});\n","plugins/response-hook.ts",[416,973,974,986,990,1008,1034,1065,1069],{"__ignoreMap":5},[441,975,976,978,980,982,984],{"class":443,"line":444},[441,977,448],{"class":447},[441,979,452],{"class":451},[441,981,455],{"class":447},[441,983,459],{"class":458},[441,985,462],{"class":451},[441,987,988],{"class":443,"line":465},[441,989,469],{"emptyLinePlaceholder":468},[441,991,992,994,996,998,1000,1002,1004,1006],{"class":443,"line":472},[441,993,475],{"class":447},[441,995,478],{"class":447},[441,997,482],{"class":481},[441,999,485],{"class":451},[441,1001,489],{"class":488},[441,1003,492],{"class":451},[441,1005,495],{"class":447},[441,1007,498],{"class":451},[441,1009,1010,1012,1014,1016,1019,1021,1024,1026,1028,1030,1032],{"class":443,"line":501},[441,1011,504],{"class":451},[441,1013,507],{"class":481},[441,1015,510],{"class":451},[441,1017,1018],{"class":458},"\"response\"",[441,1020,516],{"class":451},[441,1022,1023],{"class":488},"res",[441,1025,604],{"class":451},[441,1027,519],{"class":488},[441,1029,492],{"class":451},[441,1031,495],{"class":447},[441,1033,498],{"class":451},[441,1035,1036,1038,1040,1042,1045,1047,1049,1052,1055,1057,1059,1061,1063],{"class":443,"line":528},[441,1037,531],{"class":451},[441,1039,534],{"class":481},[441,1041,510],{"class":451},[441,1043,1044],{"class":458},"`Response ${",[441,1046,1023],{"class":451},[441,1048,544],{"class":458},[441,1050,1051],{"class":451},"status",[441,1053,1054],{"class":458},"} for ${",[441,1056,519],{"class":451},[441,1058,544],{"class":458},[441,1060,547],{"class":451},[441,1062,550],{"class":458},[441,1064,553],{"class":451},[441,1066,1067],{"class":443,"line":556},[441,1068,559],{"class":451},[441,1070,1071],{"class":443,"line":562},[441,1072,565],{"class":451},[567,1074,1075],{},[405,1076,422,1077,1079],{},[416,1078,957],{}," hook runs for every response, including static assets, middleware-terminated requests, and error responses.",[400,1081,1083],{"id":1082},"error-handling","Error handling",[405,1085,1086],{},"When an error occurs at any point in the request lifecycle, Nitro:",[409,1088,1090,1097],{"level":1089},"4",[1091,1092,1093,1094,1096],"h4",{},"Calls the ",[416,1095,580],{}," hook with the error and context (including the event and source tags).",[1091,1098,1099,1100,1103],{},"Passes the error to the ",[594,1101,1102],{},"error handler"," which converts it into an HTTP response.",[432,1105,1108],{"className":434,"code":1106,"filename":1107,"language":437,"meta":5,"style":5},"import { definePlugin } from \"nitro\";\n\nexport default definePlugin((nitroApp) => {\n  nitroApp.hooks.hook(\"error\", (error, context) => {\n    console.error(\"Captured error:\", error);\n    // context.event - the H3 event (if available)\n    // context.tags  - error source tags like \"request\", \"response\", \"plugin\"\n  });\n});\n","plugins/errors.ts",[416,1109,1110,1122,1126,1144,1170,1184,1190,1195,1200],{"__ignoreMap":5},[441,1111,1112,1114,1116,1118,1120],{"class":443,"line":444},[441,1113,448],{"class":447},[441,1115,452],{"class":451},[441,1117,455],{"class":447},[441,1119,459],{"class":458},[441,1121,462],{"class":451},[441,1123,1124],{"class":443,"line":465},[441,1125,469],{"emptyLinePlaceholder":468},[441,1127,1128,1130,1132,1134,1136,1138,1140,1142],{"class":443,"line":472},[441,1129,475],{"class":447},[441,1131,478],{"class":447},[441,1133,482],{"class":481},[441,1135,485],{"class":451},[441,1137,489],{"class":488},[441,1139,492],{"class":451},[441,1141,495],{"class":447},[441,1143,498],{"class":451},[441,1145,1146,1148,1150,1152,1155,1157,1159,1161,1164,1166,1168],{"class":443,"line":501},[441,1147,504],{"class":451},[441,1149,507],{"class":481},[441,1151,510],{"class":451},[441,1153,1154],{"class":458},"\"error\"",[441,1156,516],{"class":451},[441,1158,580],{"class":488},[441,1160,604],{"class":451},[441,1162,1163],{"class":488},"context",[441,1165,492],{"class":451},[441,1167,495],{"class":447},[441,1169,498],{"class":451},[441,1171,1172,1174,1176,1178,1181],{"class":443,"line":528},[441,1173,531],{"class":451},[441,1175,580],{"class":481},[441,1177,510],{"class":451},[441,1179,1180],{"class":458},"\"Captured error:\"",[441,1182,1183],{"class":451},", error);\n",[441,1185,1186],{"class":443,"line":556},[441,1187,1189],{"class":1188},"sCsY4","    // context.event - the H3 event (if available)\n",[441,1191,1192],{"class":443,"line":562},[441,1193,1194],{"class":1188},"    // context.tags  - error source tags like \"request\", \"response\", \"plugin\"\n",[441,1196,1198],{"class":443,"line":1197},8,[441,1199,559],{"class":451},[441,1201,1203],{"class":443,"line":1202},9,[441,1204,565],{"class":451},[405,1206,1207,1208,1211],{},"Errors are also tracked per-request in ",[416,1209,1210],{},"event.req.context.nitro.errors"," for inspection in later hooks.",[405,1213,1214],{},"You can provide a custom error handler in the Nitro config to control error response formatting:",[432,1216,1218],{"className":434,"code":1217,"filename":633,"language":437,"meta":5,"style":5},"import { defineNitroConfig } from \"nitro/config\";\n\nexport default defineNitroConfig({\n  errorHandler: \"~/error\",\n})\n",[416,1219,1220,1232,1236,1246,1257],{"__ignoreMap":5},[441,1221,1222,1224,1226,1228,1230],{"class":443,"line":444},[441,1223,448],{"class":447},[441,1225,642],{"class":451},[441,1227,455],{"class":447},[441,1229,647],{"class":458},[441,1231,462],{"class":451},[441,1233,1234],{"class":443,"line":465},[441,1235,469],{"emptyLinePlaceholder":468},[441,1237,1238,1240,1242,1244],{"class":443,"line":472},[441,1239,475],{"class":447},[441,1241,478],{"class":447},[441,1243,662],{"class":481},[441,1245,665],{"class":451},[441,1247,1248,1251,1254],{"class":443,"line":501},[441,1249,1250],{"class":451},"  errorHandler: ",[441,1252,1253],{"class":458},"\"~/error\"",[441,1255,1256],{"class":451},",\n",[441,1258,1259],{"class":443,"line":528},[441,1260,700],{"class":451},[405,1262,1263,1264,1266,1267,1270,1271,544],{},"Additionally, unhandled promise rejections and uncaught exceptions at the process level are automatically captured into the ",[416,1265,580],{}," hook with the tags ",[416,1268,1269],{},"\"unhandledRejection\""," and ",[416,1272,1273],{},"\"uncaughtException\"",[400,1275,1277],{"id":1276},"server-shutdown","Server shutdown",[405,1279,1280,1281,1284],{},"When the Nitro server is shutting down, the ",[416,1282,1283],{},"close"," hook is called. Use this to clean up resources such as database connections, timers, or external service handles:",[432,1286,1289],{"className":434,"code":1287,"filename":1288,"language":437,"meta":5,"style":5},"import { definePlugin } from \"nitro\";\n\nexport default definePlugin((nitroApp) => {\n  nitroApp.hooks.hook(\"close\", async () => {\n    // Clean up resources\n  });\n});\n","plugins/cleanup.ts",[416,1290,1291,1303,1307,1325,1348,1353,1357],{"__ignoreMap":5},[441,1292,1293,1295,1297,1299,1301],{"class":443,"line":444},[441,1294,448],{"class":447},[441,1296,452],{"class":451},[441,1298,455],{"class":447},[441,1300,459],{"class":458},[441,1302,462],{"class":451},[441,1304,1305],{"class":443,"line":465},[441,1306,469],{"emptyLinePlaceholder":468},[441,1308,1309,1311,1313,1315,1317,1319,1321,1323],{"class":443,"line":472},[441,1310,475],{"class":447},[441,1312,478],{"class":447},[441,1314,482],{"class":481},[441,1316,485],{"class":451},[441,1318,489],{"class":488},[441,1320,492],{"class":451},[441,1322,495],{"class":447},[441,1324,498],{"class":451},[441,1326,1327,1329,1331,1333,1336,1338,1341,1344,1346],{"class":443,"line":501},[441,1328,504],{"class":451},[441,1330,507],{"class":481},[441,1332,510],{"class":451},[441,1334,1335],{"class":458},"\"close\"",[441,1337,604],{"class":451},[441,1339,1340],{"class":447},"async",[441,1342,1343],{"class":451}," () ",[441,1345,495],{"class":447},[441,1347,498],{"class":451},[441,1349,1350],{"class":443,"line":528},[441,1351,1352],{"class":1188},"    // Clean up resources\n",[441,1354,1355],{"class":443,"line":556},[441,1356,559],{"class":451},[441,1358,1359],{"class":443,"line":562},[441,1360,565],{"class":451},[400,1362,1364],{"id":1363},"hooks-reference","Hooks reference",[405,1366,1367,1368,1371,1372,544],{},"All runtime hooks are registered through ",[427,1369,1370],{"href":54},"server plugins"," using ",[416,1373,1374],{},"nitroApp.hooks.hook()",[1376,1377,1378,1394],"table",{},[1379,1380,1381],"thead",{},[1382,1383,1384,1388,1391],"tr",{},[1385,1386,1387],"th",{},"Hook",[1385,1389,1390],{},"Signature",[1385,1392,1393],{},"When it runs",[1395,1396,1397,1412,1426,1440],"tbody",{},[1382,1398,1399,1404,1409],{},[1400,1401,1402],"td",{},[416,1403,418],{},[1400,1405,1406],{},[416,1407,1408],{},"(event: HTTPEvent) => void | Promise\u003Cvoid>",[1400,1410,1411],{},"Start of each request, before routing.",[1382,1413,1414,1418,1423],{},[1400,1415,1416],{},[416,1417,957],{},[1400,1419,1420],{},[416,1421,1422],{},"(res: Response, event: HTTPEvent) => void | Promise\u003Cvoid>",[1400,1424,1425],{},"After the response is created, before it is sent.",[1382,1427,1428,1432,1437],{},[1400,1429,1430],{},[416,1431,580],{},[1400,1433,1434],{},[416,1435,1436],{},"(error: Error, context: { event?, tags? }) => void",[1400,1438,1439],{},"When any error is captured during the lifecycle.",[1382,1441,1442,1446,1451],{},[1400,1443,1444],{},[416,1445,1283],{},[1400,1447,1448],{},[416,1449,1450],{},"() => void",[1400,1452,1453],{},"When the Nitro server is shutting down.",[567,1455,1456],{},[405,1457,422,1458,1461],{},[416,1459,1460],{},"NitroRuntimeHooks"," interface is augmentable. Deployment presets (such as Cloudflare) can extend it with platform-specific hooks.",[702,1463,1464],{"to":54},[405,1465,1466],{},"Learn more about Nitro plugins and hook usage examples.",[1468,1469,1470],"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 .sQHwn, html code.shiki .sQHwn{--shiki-light:#E36209;--shiki-default:#FFAB70;--shiki-dark:#FFAB70}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 .suiK_, html code.shiki .suiK_{--shiki-light:#005CC5;--shiki-default:#79B8FF;--shiki-dark:#79B8FF}html pre.shiki code .sCsY4, html code.shiki .sCsY4{--shiki-light:#6A737D;--shiki-default:#6A737D;--shiki-dark:#6A737D}",{"title":5,"searchDepth":465,"depth":465,"links":1472},[1473,1485,1486,1487],{"id":402,"depth":465,"text":403,"children":1474},[1475,1477,1478,1479,1480,1481,1482,1483],{"id":414,"depth":472,"text":1476},"request hook",{"id":584,"depth":472,"text":585},{"id":625,"depth":472,"text":626},{"id":708,"depth":472,"text":709},{"id":794,"depth":472,"text":795},{"id":808,"depth":472,"text":809},{"id":943,"depth":472,"text":18},{"id":954,"depth":472,"text":1484},"response hook",{"id":1082,"depth":465,"text":1083},{"id":1276,"depth":465,"text":1277},{"id":1363,"depth":465,"text":1364},"Understand how Nitro runs and serves incoming requests to your application.","md",{"icon":46},{"icon":46},{"title":43,"description":1488},"I3k2q5hn5JekuCe722O32DlzGxy-G-p-uoxLbIYOz2k",[1495,1497],{"title":38,"path":39,"stem":40,"description":1496,"icon":41,"children":-1},"Nitro provides a built-in and lightweight SQL database layer.",{"title":48,"path":49,"stem":50,"description":1498,"icon":51,"children":-1},"Nitro can automatically generate an OpenAPI specification from your route handlers and serve interactive API documentation.",1775834864592]