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