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