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