[{"data":1,"prerenderedAt":705},["ShallowReactive",2],{"navigation":3,"-docs-plugins":217,"-docs-plugins-surround":700},[4,83,208,214],{"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],{"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},"Zerops","/deploy/providers/zerops","2.deploy/20.providers/zerops",{"title":209,"path":210,"stem":211,"children":212,"icon":36},"Config","/config","3.config/0.index",[213],{"title":209,"path":210,"stem":211,"icon":36},{"title":5,"path":215,"stem":216},"/","index",{"id":218,"title":48,"body":219,"description":694,"extension":695,"meta":696,"navigation":697,"path":49,"seo":698,"stem":50,"__hash__":699},"content/1.docs/50.plugins.md",{"type":220,"value":221,"toc":684,"icon":51},"minimark",[222,229,242,249,254,320,327,385,390,401,405,470,475,494,498,502,505,596,600,603,607,610,680],[223,224,225],"warning",{},[226,227,228],"p",{},"Nitro v3 Alpha docs are a work in progress — expect updates, rough edges, and occasional inaccuracies.",[226,230,231,232,236,237,241],{},"Nitro plugins will be ",[233,234,235],"strong",{},"executed once"," during server startup in order to allow extending Nitro's runtime behavior.\nThey receive ",[238,239,240],"code",{},"nitroApp"," context, which can be used to hook into Nitro lifecycle events.",[226,243,244,245,248],{},"Plugins are auto-registered from ",[238,246,247],{},"plugins/"," directory and run synchronously (by order of file name) on the first Nitro initialization.",[226,250,251],{},[233,252,253],{},"Example:",[255,256,261],"pre",{"className":257,"code":258,"filename":259,"language":260,"meta":5,"style":5},"language-ts shiki shiki-themes github-light github-dark github-dark","export default defineNitroPlugin((nitroApp) => {\n  console.log('Nitro plugin', nitroApp)\n})\n","plugins/test.ts","ts",[238,262,263,295,314],{"__ignoreMap":5},[264,265,268,272,275,279,283,286,289,292],"span",{"class":266,"line":267},"line",1,[264,269,271],{"class":270},"so5gQ","export",[264,273,274],{"class":270}," default",[264,276,278],{"class":277},"shcOC"," defineNitroPlugin",[264,280,282],{"class":281},"slsVL","((",[264,284,240],{"class":285},"sQHwn",[264,287,288],{"class":281},") ",[264,290,291],{"class":270},"=>",[264,293,294],{"class":281}," {\n",[264,296,298,301,304,307,311],{"class":266,"line":297},2,[264,299,300],{"class":281},"  console.",[264,302,303],{"class":277},"log",[264,305,306],{"class":281},"(",[264,308,310],{"class":309},"sfrk1","'Nitro plugin'",[264,312,313],{"class":281},", nitroApp)\n",[264,315,317],{"class":266,"line":316},3,[264,318,319],{"class":281},"})\n",[226,321,322,323,326],{},"If you have plugins in another directory, you can use the ",[238,324,325],{},"plugins"," option:",[255,328,331],{"className":257,"code":329,"filename":330,"language":260,"meta":5,"style":5},"import { defineNitroConfig } from \"nitro/config\";\n\nexport default defineNitroConfig({\n  plugins: ['my-plugins/hello.ts']\n})\n","nitro.config.ts",[238,332,333,350,356,368,380],{"__ignoreMap":5},[264,334,335,338,341,344,347],{"class":266,"line":267},[264,336,337],{"class":270},"import",[264,339,340],{"class":281}," { defineNitroConfig } ",[264,342,343],{"class":270},"from",[264,345,346],{"class":309}," \"nitro/config\"",[264,348,349],{"class":281},";\n",[264,351,352],{"class":266,"line":297},[264,353,355],{"emptyLinePlaceholder":354},true,"\n",[264,357,358,360,362,365],{"class":266,"line":316},[264,359,271],{"class":270},[264,361,274],{"class":270},[264,363,364],{"class":277}," defineNitroConfig",[264,366,367],{"class":281},"({\n",[264,369,371,374,377],{"class":266,"line":370},4,[264,372,373],{"class":281},"  plugins: [",[264,375,376],{"class":309},"'my-plugins/hello.ts'",[264,378,379],{"class":281},"]\n",[264,381,383],{"class":266,"line":382},5,[264,384,319],{"class":281},[386,387,389],"h2",{"id":388},"nitro-runtime-hooks","Nitro runtime hooks",[226,391,392,393,400],{},"You can use Nitro ",[394,395,399],"a",{"href":396,"rel":397},"https://github.com/unjs/hookable",[398],"nofollow","hooks"," to extend the default runtime behaviour of Nitro by registering custom (async or sync) functions to the lifecycle events within plugins.",[226,402,403],{},[233,404,253],{},[255,406,408],{"className":257,"code":407,"language":260,"meta":5,"style":5},"export default defineNitroPlugin((nitro) => {\n  nitro.hooks.hook(\"close\", async () => {\n    // Will run when nitro is being closed\n  });\n})\n",[238,409,410,429,455,461,466],{"__ignoreMap":5},[264,411,412,414,416,418,420,423,425,427],{"class":266,"line":267},[264,413,271],{"class":270},[264,415,274],{"class":270},[264,417,278],{"class":277},[264,419,282],{"class":281},[264,421,422],{"class":285},"nitro",[264,424,288],{"class":281},[264,426,291],{"class":270},[264,428,294],{"class":281},[264,430,431,434,437,439,442,445,448,451,453],{"class":266,"line":297},[264,432,433],{"class":281},"  nitro.hooks.",[264,435,436],{"class":277},"hook",[264,438,306],{"class":281},[264,440,441],{"class":309},"\"close\"",[264,443,444],{"class":281},", ",[264,446,447],{"class":270},"async",[264,449,450],{"class":281}," () ",[264,452,291],{"class":270},[264,454,294],{"class":281},[264,456,457],{"class":266,"line":316},[264,458,460],{"class":459},"sCsY4","    // Will run when nitro is being closed\n",[264,462,463],{"class":266,"line":370},[264,464,465],{"class":281},"  });\n",[264,467,468],{"class":266,"line":382},[264,469,319],{"class":281},[471,472,474],"h3",{"id":473},"available-hooks","Available hooks",[476,477,478,484,489],"ul",{},[479,480,481],"li",{},[238,482,483],{},"\"request\", (event) => {}",[479,485,486],{},[238,487,488],{},"\"error\", (error, { event? }) => {}",[479,490,491],{},[238,492,493],{},"\"response\", (event, { body }) => {}",[386,495,497],{"id":496},"examples","Examples",[471,499,501],{"id":500},"capturing-errors","Capturing errors",[226,503,504],{},"You can use plugins to capture all application errors.",[255,506,508],{"className":257,"code":507,"language":260,"meta":5,"style":5},"export default defineNitroPlugin((nitro) => {\n  nitro.hooks.hook(\"error\", async (error, { event }) => {\n    console.error(`${event.path} Application error:`, error)\n  });\n})\n",[238,509,510,528,562,588,592],{"__ignoreMap":5},[264,511,512,514,516,518,520,522,524,526],{"class":266,"line":267},[264,513,271],{"class":270},[264,515,274],{"class":270},[264,517,278],{"class":277},[264,519,282],{"class":281},[264,521,422],{"class":285},[264,523,288],{"class":281},[264,525,291],{"class":270},[264,527,294],{"class":281},[264,529,530,532,534,536,539,541,543,546,549,552,555,558,560],{"class":266,"line":297},[264,531,433],{"class":281},[264,533,436],{"class":277},[264,535,306],{"class":281},[264,537,538],{"class":309},"\"error\"",[264,540,444],{"class":281},[264,542,447],{"class":270},[264,544,545],{"class":281}," (",[264,547,548],{"class":285},"error",[264,550,551],{"class":281},", { ",[264,553,554],{"class":285},"event",[264,556,557],{"class":281}," }) ",[264,559,291],{"class":270},[264,561,294],{"class":281},[264,563,564,567,569,571,574,576,579,582,585],{"class":266,"line":316},[264,565,566],{"class":281},"    console.",[264,568,548],{"class":277},[264,570,306],{"class":281},[264,572,573],{"class":309},"`${",[264,575,554],{"class":281},[264,577,578],{"class":309},".",[264,580,581],{"class":281},"path",[264,583,584],{"class":309},"} Application error:`",[264,586,587],{"class":281},", error)\n",[264,589,590],{"class":266,"line":370},[264,591,465],{"class":281},[264,593,594],{"class":266,"line":382},[264,595,319],{"class":281},[471,597,599],{"id":598},"graceful-shutdown","Graceful shutdown",[226,601,602],{},"Server will gracefully shutdown and wait for any background pending tasks initiated by event.waitUntil",[471,604,606],{"id":605},"request-and-response-lifecycle","Request and response lifecycle",[226,608,609],{},"You can use plugins to register a hook that can run on request lifecycle:",[255,611,613],{"className":257,"code":612,"language":260,"meta":5,"style":5},"export default defineNitroPlugin((nitroApp) => {\n  nitroApp.hooks.hook(\"request\", (req) => {\n    console.log(\"on request\", req.url);\n  });\n});\n",[238,614,615,633,657,671,675],{"__ignoreMap":5},[264,616,617,619,621,623,625,627,629,631],{"class":266,"line":267},[264,618,271],{"class":270},[264,620,274],{"class":270},[264,622,278],{"class":277},[264,624,282],{"class":281},[264,626,240],{"class":285},[264,628,288],{"class":281},[264,630,291],{"class":270},[264,632,294],{"class":281},[264,634,635,638,640,642,645,648,651,653,655],{"class":266,"line":297},[264,636,637],{"class":281},"  nitroApp.hooks.",[264,639,436],{"class":277},[264,641,306],{"class":281},[264,643,644],{"class":309},"\"request\"",[264,646,647],{"class":281},", (",[264,649,650],{"class":285},"req",[264,652,288],{"class":281},[264,654,291],{"class":270},[264,656,294],{"class":281},[264,658,659,661,663,665,668],{"class":266,"line":316},[264,660,566],{"class":281},[264,662,303],{"class":277},[264,664,306],{"class":281},[264,666,667],{"class":309},"\"on request\"",[264,669,670],{"class":281},", req.url);\n",[264,672,673],{"class":266,"line":370},[264,674,465],{"class":281},[264,676,677],{"class":266,"line":382},[264,678,679],{"class":281},"});\n",[681,682,683],"style",{},"html pre.shiki code .so5gQ, html code.shiki .so5gQ{--shiki-light:#D73A49;--shiki-default:#F97583;--shiki-dark:#F97583}html pre.shiki code .shcOC, html code.shiki .shcOC{--shiki-light:#6F42C1;--shiki-default:#B392F0;--shiki-dark:#B392F0}html pre.shiki code .slsVL, html code.shiki .slsVL{--shiki-light:#24292E;--shiki-default:#E1E4E8;--shiki-dark:#E1E4E8}html pre.shiki code .sQHwn, html code.shiki .sQHwn{--shiki-light:#E36209;--shiki-default:#FFAB70;--shiki-dark:#FFAB70}html pre.shiki code .sfrk1, html code.shiki .sfrk1{--shiki-light:#032F62;--shiki-default:#9ECBFF;--shiki-dark:#9ECBFF}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}",{"title":5,"searchDepth":297,"depth":297,"links":685},[686,689],{"id":388,"depth":297,"text":389,"children":687},[688],{"id":473,"depth":316,"text":474},{"id":496,"depth":297,"text":497,"children":690},[691,692,693],{"id":500,"depth":316,"text":501},{"id":598,"depth":316,"text":599},{"id":605,"depth":316,"text":606},"Use plugins to extend Nitro's runtime behavior.","md",{"icon":51},{"icon":51},{"title":48,"description":694},"wj97p37BHcDEnJSio14Th3pnw9dgbAXb0xb9IbKc0Xc",[701,703],{"title":43,"path":44,"stem":45,"description":702,"icon":46,"children":-1},"Understand how Nitro runs and serves incoming requests to your application.",{"title":53,"path":54,"stem":55,"description":704,"icon":56,"children":-1},"Nitro tasks allow on-off operations in runtime.",1764005906105]