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