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