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