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