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