[{"data":1,"prerenderedAt":1651},["ShallowReactive",2],{"navigation":3,"-docs-plugins":398,"-docs-plugins-surround":1646},[4,93,222,228,383,395],{"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],{"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},"Firebase","/deploy/providers/firebase","2.deploy/20.providers/firebase",{"title":163,"path":164,"stem":165},"Flightcontrol","/deploy/providers/flightcontrol","2.deploy/20.providers/flightcontrol",{"title":167,"path":168,"stem":169},"Genezio","/deploy/providers/genezio","2.deploy/20.providers/genezio",{"title":171,"path":172,"stem":173},"GitHub Pages","/deploy/providers/github-pages","2.deploy/20.providers/github-pages",{"title":175,"path":176,"stem":177},"GitLab Pages","/deploy/providers/gitlab-pages","2.deploy/20.providers/gitlab-pages",{"title":179,"path":180,"stem":181},"Heroku","/deploy/providers/heroku","2.deploy/20.providers/heroku",{"title":183,"path":184,"stem":185},"IIS","/deploy/providers/iis","2.deploy/20.providers/iis",{"title":187,"path":188,"stem":189},"Koyeb","/deploy/providers/koyeb","2.deploy/20.providers/koyeb",{"title":191,"path":192,"stem":193},"Netlify","/deploy/providers/netlify","2.deploy/20.providers/netlify",{"title":195,"path":196,"stem":197},"Platform.sh","/deploy/providers/platform-sh","2.deploy/20.providers/platform-sh",{"title":199,"path":200,"stem":201},"Render.com","/deploy/providers/render","2.deploy/20.providers/render",{"title":203,"path":204,"stem":205},"StormKit","/deploy/providers/stormkit","2.deploy/20.providers/stormkit",{"title":207,"path":208,"stem":209},"Vercel","/deploy/providers/vercel","2.deploy/20.providers/vercel",{"title":211,"path":212,"stem":213},"Zeabur","/deploy/providers/zeabur","2.deploy/20.providers/zeabur",{"title":215,"path":216,"stem":217},"Zephyr Cloud","/deploy/providers/zephyr","2.deploy/20.providers/zephyr",{"title":219,"path":220,"stem":221},"Zerops","/deploy/providers/zerops","2.deploy/20.providers/zerops",{"title":223,"path":224,"stem":225,"children":226,"icon":36},"Config","/config","3.config/0.index",[227],{"title":223,"path":224,"stem":225,"icon":36},{"title":229,"path":230,"stem":231,"children":232,"icon":234},"Examples","/examples","4.examples/0.index",[233,235,240,245,250,255,259,264,269,274,279,284,289,293,298,302,306,311,316,321,326,331,336,341,346,351,355,360,365,369,374,379],{"title":229,"path":230,"stem":231,"icon":234},"i-lucide-folder-code",{"title":236,"path":237,"stem":238,"icon":239},"API Routes","/examples/api-routes","4.examples/api-routes","i-lucide-route",{"title":241,"path":242,"stem":243,"icon":244},"Auto Imports","/examples/auto-imports","4.examples/auto-imports","i-lucide-import",{"title":246,"path":247,"stem":248,"icon":249},"Cached Handler","/examples/cached-handler","4.examples/cached-handler","i-lucide-clock",{"title":251,"path":252,"stem":253,"icon":254},"Custom Error Handler","/examples/custom-error-handler","4.examples/custom-error-handler","i-lucide-alert-circle",{"title":38,"path":256,"stem":257,"icon":258},"/examples/database","4.examples/database","i-lucide-database",{"title":260,"path":261,"stem":262,"icon":263},"Elysia","/examples/elysia","4.examples/elysia","i-skill-icons-elysia-dark",{"title":265,"path":266,"stem":267,"icon":268},"Express","/examples/express","4.examples/express","i-simple-icons-express",{"title":270,"path":271,"stem":272,"icon":273},"Fastify","/examples/fastify","4.examples/fastify","i-simple-icons-fastify",{"title":275,"path":276,"stem":277,"icon":278},"Hello World","/examples/hello-world","4.examples/hello-world","i-lucide-sparkles",{"title":280,"path":281,"stem":282,"icon":283},"Hono","/examples/hono","4.examples/hono","i-logos-hono",{"title":285,"path":286,"stem":287,"icon":288},"Import Alias","/examples/import-alias","4.examples/import-alias","i-lucide-at-sign",{"title":290,"path":291,"stem":292,"icon":46},"Middleware","/examples/middleware","4.examples/middleware",{"title":294,"path":295,"stem":296,"icon":297},"Mono JSX","/examples/mono-jsx","4.examples/mono-jsx","i-lucide-brackets",{"title":299,"path":300,"stem":301,"icon":297},"Nano JSX","/examples/nano-jsx","4.examples/nano-jsx",{"title":53,"path":303,"stem":304,"icon":305},"/examples/plugins","4.examples/plugins","i-lucide-plug",{"title":307,"path":308,"stem":309,"icon":310},"Custom Renderer","/examples/renderer","4.examples/renderer","i-lucide-code",{"title":312,"path":313,"stem":314,"icon":315},"Runtime Config","/examples/runtime-config","4.examples/runtime-config","i-lucide-settings",{"title":317,"path":318,"stem":319,"icon":320},"Server Fetch","/examples/server-fetch","4.examples/server-fetch","i-lucide-arrow-right-left",{"title":322,"path":323,"stem":324,"icon":325},"Shiki","/examples/shiki","4.examples/shiki","i-lucide-highlighter",{"title":327,"path":328,"stem":329,"icon":330},"Virtual Routes","/examples/virtual-routes","4.examples/virtual-routes","i-lucide-box",{"title":332,"path":333,"stem":334,"icon":335},"Vite Nitro Plugin","/examples/vite-nitro-plugin","4.examples/vite-nitro-plugin","i-logos-vitejs",{"title":337,"path":338,"stem":339,"icon":340},"Vite RSC","/examples/vite-rsc","4.examples/vite-rsc","i-logos-react",{"title":342,"path":343,"stem":344,"icon":345},"Vite SSR HTML","/examples/vite-ssr-html","4.examples/vite-ssr-html","i-logos-html-5",{"title":347,"path":348,"stem":349,"icon":350},"SSR with Preact","/examples/vite-ssr-preact","4.examples/vite-ssr-preact","i-logos-preact",{"title":352,"path":353,"stem":354,"icon":340},"SSR with React","/examples/vite-ssr-react","4.examples/vite-ssr-react",{"title":356,"path":357,"stem":358,"icon":359},"SSR with SolidJS","/examples/vite-ssr-solid","4.examples/vite-ssr-solid","i-logos-solidjs-icon",{"title":361,"path":362,"stem":363,"icon":364},"SSR with TanStack Router","/examples/vite-ssr-tsr-react","4.examples/vite-ssr-tsr-react","i-simple-icons-tanstack",{"title":366,"path":367,"stem":368,"icon":364},"SSR with TanStack Start","/examples/vite-ssr-tss-react","4.examples/vite-ssr-tss-react",{"title":370,"path":371,"stem":372,"icon":373},"SSR with Vue Router","/examples/vite-ssr-vue-router","4.examples/vite-ssr-vue-router","i-logos-vue",{"title":375,"path":376,"stem":377,"icon":378},"Vite + tRPC","/examples/vite-trpc","4.examples/vite-trpc","i-simple-icons-trpc",{"title":63,"path":380,"stem":381,"icon":382},"/examples/websocket","4.examples/websocket","i-lucide-radio",{"title":384,"path":385,"stem":386,"children":387},"Blog","/blog","9.blog",[388,391],{"title":384,"path":385,"stem":389,"icon":390},"9.blog/index","i-lucide-file-text",{"title":392,"path":393,"stem":394,"icon":390},"Nitro v3 Beta is here!","/blog/v3-beta","9.blog/1.v3-beta",{"title":5,"path":396,"stem":397},"/","index",{"id":399,"title":53,"body":400,"description":1640,"extension":1641,"meta":1642,"navigation":1643,"path":54,"seo":1644,"stem":55,"__hash__":1645},"content/1.docs/50.plugins.md",{"type":401,"value":402,"toc":1625,"icon":56},"minimark",[403,417,428,433,524,531,581,589,595,690,694,701,705,787,791,867,885,889,895,1002,1005,1009,1012,1117,1145,1149,1155,1236,1240,1246,1318,1322,1325,1460,1464,1621],[404,405,406,407,411,412,416],"p",{},"Nitro plugins are ",[408,409,410],"strong",{},"executed once"," during server startup in order to allow extending Nitro's runtime behavior.\nThey receive ",[413,414,415],"code",{},"nitroApp"," context, which can be used to hook into lifecycle events.",[404,418,419,420,423,424,427],{},"Plugins are auto-registered from the ",[413,421,422],{},"plugins/"," directory and run synchronously by file name order on the first Nitro initialization. Plugin functions themselves must be synchronous (return ",[413,425,426],{},"void","), but the hooks they register can be async.",[404,429,430],{},[408,431,432],{},"Example:",[434,435,440],"pre",{"className":436,"code":437,"filename":438,"language":439,"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  console.log('Nitro plugin', nitroApp)\n})\n","plugins/test.ts","ts",[413,441,442,465,472,500,518],{"__ignoreMap":5},[443,444,447,451,455,458,462],"span",{"class":445,"line":446},"line",1,[443,448,450],{"class":449},"so5gQ","import",[443,452,454],{"class":453},"slsVL"," { definePlugin } ",[443,456,457],{"class":449},"from",[443,459,461],{"class":460},"sfrk1"," \"nitro\"",[443,463,464],{"class":453},";\n",[443,466,468],{"class":445,"line":467},2,[443,469,471],{"emptyLinePlaceholder":470},true,"\n",[443,473,475,478,481,485,488,491,494,497],{"class":445,"line":474},3,[443,476,477],{"class":449},"export",[443,479,480],{"class":449}," default",[443,482,484],{"class":483},"shcOC"," definePlugin",[443,486,487],{"class":453},"((",[443,489,415],{"class":490},"sQHwn",[443,492,493],{"class":453},") ",[443,495,496],{"class":449},"=>",[443,498,499],{"class":453}," {\n",[443,501,503,506,509,512,515],{"class":445,"line":502},4,[443,504,505],{"class":453},"  console.",[443,507,508],{"class":483},"log",[443,510,511],{"class":453},"(",[443,513,514],{"class":460},"'Nitro plugin'",[443,516,517],{"class":453},", nitroApp)\n",[443,519,521],{"class":445,"line":520},5,[443,522,523],{"class":453},"})\n",[404,525,526,527,530],{},"If you have plugins in another directory, you can use the ",[413,528,529],{},"plugins"," option:",[434,532,535],{"className":436,"code":533,"filename":534,"language":439,"meta":5,"style":5},"import { defineConfig } from \"nitro\";\n\nexport default defineConfig({\n  plugins: ['my-plugins/hello.ts']\n})\n","nitro.config.ts",[413,536,537,550,554,566,577],{"__ignoreMap":5},[443,538,539,541,544,546,548],{"class":445,"line":446},[443,540,450],{"class":449},[443,542,543],{"class":453}," { defineConfig } ",[443,545,457],{"class":449},[443,547,461],{"class":460},[443,549,464],{"class":453},[443,551,552],{"class":445,"line":467},[443,553,471],{"emptyLinePlaceholder":470},[443,555,556,558,560,563],{"class":445,"line":474},[443,557,477],{"class":449},[443,559,480],{"class":449},[443,561,562],{"class":483}," defineConfig",[443,564,565],{"class":453},"({\n",[443,567,568,571,574],{"class":445,"line":502},[443,569,570],{"class":453},"  plugins: [",[443,572,573],{"class":460},"'my-plugins/hello.ts'",[443,575,576],{"class":453},"]\n",[443,578,579],{"class":445,"line":520},[443,580,523],{"class":453},[582,583,585,586,588],"h2",{"id":584},"the-nitroapp-context","The ",[413,587,415],{}," context",[404,590,591,592,594],{},"The plugin function receives a ",[413,593,415],{}," object with the following properties:",[596,597,598,614],"table",{},[599,600,601],"thead",{},[602,603,604,608,611],"tr",{},[605,606,607],"th",{},"Property",[605,609,610],{},"Type",[605,612,613],{},"Description",[615,616,617,639,660,675],"tbody",{},[602,618,619,625,636],{},[620,621,622],"td",{},[413,623,624],{},"hooks",[620,626,627],{},[628,629,633],"a",{"href":630,"rel":631},"https://github.com/unjs/hookable",[632],"nofollow",[413,634,635],{},"HookableCore",[620,637,638],{},"Hook system for registering lifecycle callbacks.",[602,640,641,646,651],{},[620,642,643],{},[413,644,645],{},"h3",[620,647,648],{},[413,649,650],{},"H3Core",[620,652,653,654,659],{},"The underlying ",[628,655,658],{"href":656,"rel":657},"https://github.com/h3js/h3",[632],"H3"," application instance.",[602,661,662,667,672],{},[620,663,664],{},[413,665,666],{},"fetch",[620,668,669],{},[413,670,671],{},"(req: Request) => Response | Promise\u003CResponse>",[620,673,674],{},"The app's internal fetch handler.",[602,676,677,682,687],{},[620,678,679],{},[413,680,681],{},"captureError",[620,683,684],{},[413,685,686],{},"(error: Error, context) => void",[620,688,689],{},"Programmatically capture errors into the error hook pipeline.",[582,691,693],{"id":692},"nitro-runtime-hooks","Nitro runtime hooks",[404,695,696,697,700],{},"You can use Nitro ",[628,698,624],{"href":630,"rel":699},[632]," to extend the default runtime behaviour of Nitro by registering custom functions to the lifecycle events within plugins.",[404,702,703],{},[408,704,432],{},[434,706,708],{"className":436,"code":707,"language":439,"meta":5,"style":5},"import { definePlugin } from \"nitro\";\n\nexport default definePlugin((nitroApp) => {\n  nitroApp.hooks.hook(\"close\", async () => {\n    // Will run when nitro is being closed\n  });\n})\n",[413,709,710,722,726,744,770,776,782],{"__ignoreMap":5},[443,711,712,714,716,718,720],{"class":445,"line":446},[443,713,450],{"class":449},[443,715,454],{"class":453},[443,717,457],{"class":449},[443,719,461],{"class":460},[443,721,464],{"class":453},[443,723,724],{"class":445,"line":467},[443,725,471],{"emptyLinePlaceholder":470},[443,727,728,730,732,734,736,738,740,742],{"class":445,"line":474},[443,729,477],{"class":449},[443,731,480],{"class":449},[443,733,484],{"class":483},[443,735,487],{"class":453},[443,737,415],{"class":490},[443,739,493],{"class":453},[443,741,496],{"class":449},[443,743,499],{"class":453},[443,745,746,749,752,754,757,760,763,766,768],{"class":445,"line":502},[443,747,748],{"class":453},"  nitroApp.hooks.",[443,750,751],{"class":483},"hook",[443,753,511],{"class":453},[443,755,756],{"class":460},"\"close\"",[443,758,759],{"class":453},", ",[443,761,762],{"class":449},"async",[443,764,765],{"class":453}," () ",[443,767,496],{"class":449},[443,769,499],{"class":453},[443,771,772],{"class":445,"line":520},[443,773,775],{"class":774},"sCsY4","    // Will run when nitro is being closed\n",[443,777,779],{"class":445,"line":778},6,[443,780,781],{"class":453},"  });\n",[443,783,785],{"class":445,"line":784},7,[443,786,523],{"class":453},[645,788,790],{"id":789},"available-hooks","Available hooks",[596,792,793,805],{},[599,794,795],{},[602,796,797,800,803],{},[605,798,799],{},"Hook",[605,801,802],{},"Signature",[605,804,613],{},[615,806,807,822,837,852],{},[602,808,809,814,819],{},[620,810,811],{},[413,812,813],{},"request",[620,815,816],{},[413,817,818],{},"(event: HTTPEvent) => void | Promise\u003Cvoid>",[620,820,821],{},"Called at the start of each request.",[602,823,824,829,834],{},[620,825,826],{},[413,827,828],{},"response",[620,830,831],{},[413,832,833],{},"(res: Response, event: HTTPEvent) => void | Promise\u003Cvoid>",[620,835,836],{},"Called after the response is created.",[602,838,839,844,849],{},[620,840,841],{},[413,842,843],{},"error",[620,845,846],{},[413,847,848],{},"(error: Error, context: { event?: HTTPEvent, tags?: string[] }) => void",[620,850,851],{},"Called when an error is captured.",[602,853,854,859,864],{},[620,855,856],{},[413,857,858],{},"close",[620,860,861],{},[413,862,863],{},"() => void",[620,865,866],{},"Called when the Nitro server is shutting down.",[868,869,870],"note",{},[404,871,872,873,876,877,880,881,884],{},"\nThe ",[413,874,875],{},"NitroRuntimeHooks"," interface is augmentable. Deployment presets (such as Cloudflare) can extend it with platform-specific hooks like ",[413,878,879],{},"cloudflare:scheduled"," and ",[413,882,883],{},"cloudflare:email",".",[645,886,888],{"id":887},"unregistering-hooks","Unregistering hooks",[404,890,585,891,894],{},[413,892,893],{},"hook()"," method returns an unregister function that can be called to remove the hook:",[434,896,898],{"className":436,"code":897,"language":439,"meta":5,"style":5},"import { definePlugin } from \"nitro\";\n\nexport default definePlugin((nitroApp) => {\n  const unregister = nitroApp.hooks.hook(\"request\", (event) => {\n    // ...\n  });\n\n  // Later, remove the hook\n  unregister();\n});\n",[413,899,900,912,916,934,968,973,977,981,987,996],{"__ignoreMap":5},[443,901,902,904,906,908,910],{"class":445,"line":446},[443,903,450],{"class":449},[443,905,454],{"class":453},[443,907,457],{"class":449},[443,909,461],{"class":460},[443,911,464],{"class":453},[443,913,914],{"class":445,"line":467},[443,915,471],{"emptyLinePlaceholder":470},[443,917,918,920,922,924,926,928,930,932],{"class":445,"line":474},[443,919,477],{"class":449},[443,921,480],{"class":449},[443,923,484],{"class":483},[443,925,487],{"class":453},[443,927,415],{"class":490},[443,929,493],{"class":453},[443,931,496],{"class":449},[443,933,499],{"class":453},[443,935,936,939,943,946,949,951,953,956,959,962,964,966],{"class":445,"line":502},[443,937,938],{"class":449},"  const",[443,940,942],{"class":941},"suiK_"," unregister",[443,944,945],{"class":449}," =",[443,947,948],{"class":453}," nitroApp.hooks.",[443,950,751],{"class":483},[443,952,511],{"class":453},[443,954,955],{"class":460},"\"request\"",[443,957,958],{"class":453},", (",[443,960,961],{"class":490},"event",[443,963,493],{"class":453},[443,965,496],{"class":449},[443,967,499],{"class":453},[443,969,970],{"class":445,"line":520},[443,971,972],{"class":774},"    // ...\n",[443,974,975],{"class":445,"line":778},[443,976,781],{"class":453},[443,978,979],{"class":445,"line":784},[443,980,471],{"emptyLinePlaceholder":470},[443,982,984],{"class":445,"line":983},8,[443,985,986],{"class":774},"  // Later, remove the hook\n",[443,988,990,993],{"class":445,"line":989},9,[443,991,992],{"class":483},"  unregister",[443,994,995],{"class":453},"();\n",[443,997,999],{"class":445,"line":998},10,[443,1000,1001],{"class":453},"});\n",[582,1003,229],{"id":1004},"examples",[645,1006,1008],{"id":1007},"capturing-errors","Capturing errors",[404,1010,1011],{},"You can use plugins to capture all application errors.",[434,1013,1015],{"className":436,"code":1014,"language":439,"meta":5,"style":5},"import { definePlugin } from \"nitro\";\n\nexport default definePlugin((nitroApp) => {\n  nitroApp.hooks.hook(\"error\", async (error, { event }) => {\n    console.error(`${event?.path} Application error:`, error)\n  });\n})\n",[413,1016,1017,1029,1033,1051,1083,1109,1113],{"__ignoreMap":5},[443,1018,1019,1021,1023,1025,1027],{"class":445,"line":446},[443,1020,450],{"class":449},[443,1022,454],{"class":453},[443,1024,457],{"class":449},[443,1026,461],{"class":460},[443,1028,464],{"class":453},[443,1030,1031],{"class":445,"line":467},[443,1032,471],{"emptyLinePlaceholder":470},[443,1034,1035,1037,1039,1041,1043,1045,1047,1049],{"class":445,"line":474},[443,1036,477],{"class":449},[443,1038,480],{"class":449},[443,1040,484],{"class":483},[443,1042,487],{"class":453},[443,1044,415],{"class":490},[443,1046,493],{"class":453},[443,1048,496],{"class":449},[443,1050,499],{"class":453},[443,1052,1053,1055,1057,1059,1062,1064,1066,1069,1071,1074,1076,1079,1081],{"class":445,"line":502},[443,1054,748],{"class":453},[443,1056,751],{"class":483},[443,1058,511],{"class":453},[443,1060,1061],{"class":460},"\"error\"",[443,1063,759],{"class":453},[443,1065,762],{"class":449},[443,1067,1068],{"class":453}," (",[443,1070,843],{"class":490},[443,1072,1073],{"class":453},", { ",[443,1075,961],{"class":490},[443,1077,1078],{"class":453}," }) ",[443,1080,496],{"class":449},[443,1082,499],{"class":453},[443,1084,1085,1088,1090,1092,1095,1097,1100,1103,1106],{"class":445,"line":520},[443,1086,1087],{"class":453},"    console.",[443,1089,843],{"class":483},[443,1091,511],{"class":453},[443,1093,1094],{"class":460},"`${",[443,1096,961],{"class":453},[443,1098,1099],{"class":460},"?.",[443,1101,1102],{"class":453},"path",[443,1104,1105],{"class":460},"} Application error:`",[443,1107,1108],{"class":453},", error)\n",[443,1110,1111],{"class":445,"line":778},[443,1112,781],{"class":453},[443,1114,1115],{"class":445,"line":784},[443,1116,523],{"class":453},[404,1118,585,1119,1122,1123,1126,1127,759,1129,759,1132,759,1135,759,1138,759,1141,1144],{},[413,1120,1121],{},"context"," object includes an optional ",[413,1124,1125],{},"tags"," array that identifies the error source (e.g., ",[413,1128,955],{},[413,1130,1131],{},"\"response\"",[413,1133,1134],{},"\"cache\"",[413,1136,1137],{},"\"plugin\"",[413,1139,1140],{},"\"unhandledRejection\"",[413,1142,1143],{},"\"uncaughtException\"",").",[645,1146,1148],{"id":1147},"programmatic-error-capture","Programmatic error capture",[404,1150,1151,1152,1154],{},"You can use ",[413,1153,681],{}," to manually feed errors into the error hook pipeline:",[434,1156,1158],{"className":436,"code":1157,"language":439,"meta":5,"style":5},"import { definePlugin } from \"nitro\";\n\nexport default definePlugin((nitroApp) => {\n  nitroApp.captureError(new Error(\"something went wrong\"), {\n    tags: [\"startup\"],\n  });\n});\n",[413,1159,1160,1172,1176,1194,1217,1228,1232],{"__ignoreMap":5},[443,1161,1162,1164,1166,1168,1170],{"class":445,"line":446},[443,1163,450],{"class":449},[443,1165,454],{"class":453},[443,1167,457],{"class":449},[443,1169,461],{"class":460},[443,1171,464],{"class":453},[443,1173,1174],{"class":445,"line":467},[443,1175,471],{"emptyLinePlaceholder":470},[443,1177,1178,1180,1182,1184,1186,1188,1190,1192],{"class":445,"line":474},[443,1179,477],{"class":449},[443,1181,480],{"class":449},[443,1183,484],{"class":483},[443,1185,487],{"class":453},[443,1187,415],{"class":490},[443,1189,493],{"class":453},[443,1191,496],{"class":449},[443,1193,499],{"class":453},[443,1195,1196,1199,1201,1203,1206,1209,1211,1214],{"class":445,"line":502},[443,1197,1198],{"class":453},"  nitroApp.",[443,1200,681],{"class":483},[443,1202,511],{"class":453},[443,1204,1205],{"class":449},"new",[443,1207,1208],{"class":483}," Error",[443,1210,511],{"class":453},[443,1212,1213],{"class":460},"\"something went wrong\"",[443,1215,1216],{"class":453},"), {\n",[443,1218,1219,1222,1225],{"class":445,"line":520},[443,1220,1221],{"class":453},"    tags: [",[443,1223,1224],{"class":460},"\"startup\"",[443,1226,1227],{"class":453},"],\n",[443,1229,1230],{"class":445,"line":778},[443,1231,781],{"class":453},[443,1233,1234],{"class":445,"line":784},[443,1235,1001],{"class":453},[645,1237,1239],{"id":1238},"graceful-shutdown","Graceful shutdown",[404,1241,1242,1243,884],{},"Server will gracefully shutdown and wait for any background pending tasks initiated by ",[413,1244,1245],{},"event.waitUntil",[434,1247,1249],{"className":436,"code":1248,"language":439,"meta":5,"style":5},"import { definePlugin } from \"nitro\";\n\nexport default definePlugin((nitroApp) => {\n  nitroApp.hooks.hook(\"close\", async () => {\n    // Clean up resources, close connections, etc.\n  });\n});\n",[413,1250,1251,1263,1267,1285,1305,1310,1314],{"__ignoreMap":5},[443,1252,1253,1255,1257,1259,1261],{"class":445,"line":446},[443,1254,450],{"class":449},[443,1256,454],{"class":453},[443,1258,457],{"class":449},[443,1260,461],{"class":460},[443,1262,464],{"class":453},[443,1264,1265],{"class":445,"line":467},[443,1266,471],{"emptyLinePlaceholder":470},[443,1268,1269,1271,1273,1275,1277,1279,1281,1283],{"class":445,"line":474},[443,1270,477],{"class":449},[443,1272,480],{"class":449},[443,1274,484],{"class":483},[443,1276,487],{"class":453},[443,1278,415],{"class":490},[443,1280,493],{"class":453},[443,1282,496],{"class":449},[443,1284,499],{"class":453},[443,1286,1287,1289,1291,1293,1295,1297,1299,1301,1303],{"class":445,"line":502},[443,1288,748],{"class":453},[443,1290,751],{"class":483},[443,1292,511],{"class":453},[443,1294,756],{"class":460},[443,1296,759],{"class":453},[443,1298,762],{"class":449},[443,1300,765],{"class":453},[443,1302,496],{"class":449},[443,1304,499],{"class":453},[443,1306,1307],{"class":445,"line":520},[443,1308,1309],{"class":774},"    // Clean up resources, close connections, etc.\n",[443,1311,1312],{"class":445,"line":778},[443,1313,781],{"class":453},[443,1315,1316],{"class":445,"line":784},[443,1317,1001],{"class":453},[645,1319,1321],{"id":1320},"request-and-response-lifecycle","Request and response lifecycle",[404,1323,1324],{},"You can use plugins to register hooks that run on the request lifecycle:",[434,1326,1328],{"className":436,"code":1327,"language":439,"meta":5,"style":5},"import { definePlugin } from \"nitro\";\n\nexport default definePlugin((nitroApp) => {\n  nitroApp.hooks.hook(\"request\", (event) => {\n    console.log(\"on request\", event.path);\n  });\n\n  nitroApp.hooks.hook(\"response\", (res, event) => {\n    // Modify or inspect the response\n    console.log(\"on response\", res.status);\n  });\n});\n",[413,1329,1330,1342,1346,1364,1384,1398,1402,1406,1431,1436,1450,1455],{"__ignoreMap":5},[443,1331,1332,1334,1336,1338,1340],{"class":445,"line":446},[443,1333,450],{"class":449},[443,1335,454],{"class":453},[443,1337,457],{"class":449},[443,1339,461],{"class":460},[443,1341,464],{"class":453},[443,1343,1344],{"class":445,"line":467},[443,1345,471],{"emptyLinePlaceholder":470},[443,1347,1348,1350,1352,1354,1356,1358,1360,1362],{"class":445,"line":474},[443,1349,477],{"class":449},[443,1351,480],{"class":449},[443,1353,484],{"class":483},[443,1355,487],{"class":453},[443,1357,415],{"class":490},[443,1359,493],{"class":453},[443,1361,496],{"class":449},[443,1363,499],{"class":453},[443,1365,1366,1368,1370,1372,1374,1376,1378,1380,1382],{"class":445,"line":502},[443,1367,748],{"class":453},[443,1369,751],{"class":483},[443,1371,511],{"class":453},[443,1373,955],{"class":460},[443,1375,958],{"class":453},[443,1377,961],{"class":490},[443,1379,493],{"class":453},[443,1381,496],{"class":449},[443,1383,499],{"class":453},[443,1385,1386,1388,1390,1392,1395],{"class":445,"line":520},[443,1387,1087],{"class":453},[443,1389,508],{"class":483},[443,1391,511],{"class":453},[443,1393,1394],{"class":460},"\"on request\"",[443,1396,1397],{"class":453},", event.path);\n",[443,1399,1400],{"class":445,"line":778},[443,1401,781],{"class":453},[443,1403,1404],{"class":445,"line":784},[443,1405,471],{"emptyLinePlaceholder":470},[443,1407,1408,1410,1412,1414,1416,1418,1421,1423,1425,1427,1429],{"class":445,"line":983},[443,1409,748],{"class":453},[443,1411,751],{"class":483},[443,1413,511],{"class":453},[443,1415,1131],{"class":460},[443,1417,958],{"class":453},[443,1419,1420],{"class":490},"res",[443,1422,759],{"class":453},[443,1424,961],{"class":490},[443,1426,493],{"class":453},[443,1428,496],{"class":449},[443,1430,499],{"class":453},[443,1432,1433],{"class":445,"line":989},[443,1434,1435],{"class":774},"    // Modify or inspect the response\n",[443,1437,1438,1440,1442,1444,1447],{"class":445,"line":998},[443,1439,1087],{"class":453},[443,1441,508],{"class":483},[443,1443,511],{"class":453},[443,1445,1446],{"class":460},"\"on response\"",[443,1448,1449],{"class":453},", res.status);\n",[443,1451,1453],{"class":445,"line":1452},11,[443,1454,781],{"class":453},[443,1456,1458],{"class":445,"line":1457},12,[443,1459,1001],{"class":453},[645,1461,1463],{"id":1462},"modifying-response-headers","Modifying response headers",[434,1465,1467],{"className":436,"code":1466,"language":439,"meta":5,"style":5},"import { definePlugin } from \"nitro\";\n\nexport default definePlugin((nitroApp) => {\n  nitroApp.hooks.hook(\"response\", (res, event) => {\n    const { pathname } = new URL(event.req.url);\n    if (pathname.endsWith(\".css\") || pathname.endsWith(\".js\")) {\n      res.headers.append(\"Vary\", \"Origin\");\n    }\n  });\n});\n",[413,1468,1469,1481,1485,1503,1527,1553,1587,1608,1613,1617],{"__ignoreMap":5},[443,1470,1471,1473,1475,1477,1479],{"class":445,"line":446},[443,1472,450],{"class":449},[443,1474,454],{"class":453},[443,1476,457],{"class":449},[443,1478,461],{"class":460},[443,1480,464],{"class":453},[443,1482,1483],{"class":445,"line":467},[443,1484,471],{"emptyLinePlaceholder":470},[443,1486,1487,1489,1491,1493,1495,1497,1499,1501],{"class":445,"line":474},[443,1488,477],{"class":449},[443,1490,480],{"class":449},[443,1492,484],{"class":483},[443,1494,487],{"class":453},[443,1496,415],{"class":490},[443,1498,493],{"class":453},[443,1500,496],{"class":449},[443,1502,499],{"class":453},[443,1504,1505,1507,1509,1511,1513,1515,1517,1519,1521,1523,1525],{"class":445,"line":502},[443,1506,748],{"class":453},[443,1508,751],{"class":483},[443,1510,511],{"class":453},[443,1512,1131],{"class":460},[443,1514,958],{"class":453},[443,1516,1420],{"class":490},[443,1518,759],{"class":453},[443,1520,961],{"class":490},[443,1522,493],{"class":453},[443,1524,496],{"class":449},[443,1526,499],{"class":453},[443,1528,1529,1532,1535,1538,1541,1544,1547,1550],{"class":445,"line":520},[443,1530,1531],{"class":449},"    const",[443,1533,1534],{"class":453}," { ",[443,1536,1537],{"class":941},"pathname",[443,1539,1540],{"class":453}," } ",[443,1542,1543],{"class":449},"=",[443,1545,1546],{"class":449}," new",[443,1548,1549],{"class":483}," URL",[443,1551,1552],{"class":453},"(event.req.url);\n",[443,1554,1555,1558,1561,1564,1566,1569,1571,1574,1577,1579,1581,1584],{"class":445,"line":778},[443,1556,1557],{"class":449},"    if",[443,1559,1560],{"class":453}," (pathname.",[443,1562,1563],{"class":483},"endsWith",[443,1565,511],{"class":453},[443,1567,1568],{"class":460},"\".css\"",[443,1570,493],{"class":453},[443,1572,1573],{"class":449},"||",[443,1575,1576],{"class":453}," pathname.",[443,1578,1563],{"class":483},[443,1580,511],{"class":453},[443,1582,1583],{"class":460},"\".js\"",[443,1585,1586],{"class":453},")) {\n",[443,1588,1589,1592,1595,1597,1600,1602,1605],{"class":445,"line":784},[443,1590,1591],{"class":453},"      res.headers.",[443,1593,1594],{"class":483},"append",[443,1596,511],{"class":453},[443,1598,1599],{"class":460},"\"Vary\"",[443,1601,759],{"class":453},[443,1603,1604],{"class":460},"\"Origin\"",[443,1606,1607],{"class":453},");\n",[443,1609,1610],{"class":445,"line":983},[443,1611,1612],{"class":453},"    }\n",[443,1614,1615],{"class":445,"line":989},[443,1616,781],{"class":453},[443,1618,1619],{"class":445,"line":998},[443,1620,1001],{"class":453},[1622,1623,1624],"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 .sCsY4, html code.shiki .sCsY4{--shiki-light:#6A737D;--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .suiK_, html code.shiki .suiK_{--shiki-light:#005CC5;--shiki-default:#79B8FF;--shiki-dark:#79B8FF}",{"title":5,"searchDepth":467,"depth":467,"links":1626},[1627,1629,1633],{"id":584,"depth":467,"text":1628},"The nitroApp context",{"id":692,"depth":467,"text":693,"children":1630},[1631,1632],{"id":789,"depth":474,"text":790},{"id":887,"depth":474,"text":888},{"id":1004,"depth":467,"text":229,"children":1634},[1635,1636,1637,1638,1639],{"id":1007,"depth":474,"text":1008},{"id":1147,"depth":474,"text":1148},{"id":1238,"depth":474,"text":1239},{"id":1320,"depth":474,"text":1321},{"id":1462,"depth":474,"text":1463},"Use plugins to extend Nitro's runtime behavior.","md",{"icon":56},{"icon":56},{"title":53,"description":1640},"_GTo-n3BA4c0a3nUJ6nx8EuxQ2IMQiLn8lFCpitAwb8",[1647,1649],{"title":48,"path":49,"stem":50,"description":1648,"icon":51,"children":-1},"Nitro can automatically generate an OpenAPI specification from your route handlers and serve interactive API documentation.",{"title":58,"path":59,"stem":60,"description":1650,"icon":61,"children":-1},"Nitro tasks allow on-off operations in runtime.",1776114764740]