[{"data":1,"prerenderedAt":1809},["ShallowReactive",2],{"navigation":3,"-docs-server-entry":377,"-docs-server-entry-surround":1804},[4,83,212,218,374],{"title":5,"path":6,"stem":7,"children":8,"icon":82},"","/docs","1.docs/1.index",[9,12,17,22,27,32,37,42,47,52,57,62,67,72,77],{"title":10,"path":6,"stem":7,"icon":11},"Introduction","i-lucide-compass",{"title":13,"path":14,"stem":15,"icon":16},"Quick Start","/docs/quick-start","1.docs/2.quick-start","i-lucide-zap",{"title":18,"path":19,"stem":20,"icon":21},"Renderer","/docs/renderer","1.docs/4.renderer","ri:layout-masonry-line",{"title":23,"path":24,"stem":25,"icon":26},"Routing","/docs/routing","1.docs/5.routing","ri:direction-line",{"title":28,"path":29,"stem":30,"icon":31},"Assets","/docs/assets","1.docs/50.assets","ri:image-2-line",{"title":33,"path":34,"stem":35,"icon":36},"Configuration","/docs/configuration","1.docs/50.configuration","ri:settings-3-line",{"title":38,"path":39,"stem":40,"icon":41},"Database","/docs/database","1.docs/50.database","ri:database-2-line",{"title":43,"path":44,"stem":45,"icon":46},"Lifecycle","/docs/lifecycle","1.docs/50.lifecycle","i-lucide-layers",{"title":48,"path":49,"stem":50,"icon":51},"Plugins","/docs/plugins","1.docs/50.plugins","ri:plug-line",{"title":53,"path":54,"stem":55,"icon":56},"Tasks","/docs/tasks","1.docs/50.tasks","codicon:run-all",{"title":58,"path":59,"stem":60,"icon":61},"Server Entry","/docs/server-entry","1.docs/6.server-entry","ri:server-line",{"title":63,"path":64,"stem":65,"icon":66},"Cache","/docs/cache","1.docs/7.cache","ri:speed-line",{"title":68,"path":69,"stem":70,"icon":71},"KV Storage","/docs/storage","1.docs/8.storage","carbon:datastore",{"title":73,"path":74,"stem":75,"icon":76},"Migration Guide","/docs/migration","1.docs/99.migration","ri:arrow-right-up-line",{"title":78,"path":79,"stem":80,"icon":81},"Nightly Channel","/docs/nightly","1.docs/99.nightly","ri:moon-fill","i-lucide-book-open",{"title":84,"path":85,"stem":86,"children":87,"icon":89},"Deploy","/deploy","2.deploy/0.index",[88,90,111],{"title":84,"path":85,"stem":86,"icon":89},"ri:upload-cloud-2-line",{"title":91,"path":92,"stem":93,"children":94,"page":110},"Runtimes","/deploy/runtimes","2.deploy/10.runtimes",[95,100,105],{"title":96,"path":97,"stem":98,"icon":99},"Node.js","/deploy/runtimes/node","2.deploy/10.runtimes/1.node","akar-icons:node-fill",{"title":101,"path":102,"stem":103,"icon":104},"Bun","/deploy/runtimes/bun","2.deploy/10.runtimes/bun","simple-icons:bun",{"title":106,"path":107,"stem":108,"icon":109},"Deno","/deploy/runtimes/deno","2.deploy/10.runtimes/deno","simple-icons:deno",false,{"title":112,"path":113,"stem":114,"children":115,"page":110},"Providers","/deploy/providers","2.deploy/20.providers",[116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204,208],{"title":117,"path":118,"stem":119},"Alwaysdata","/deploy/providers/alwaysdata","2.deploy/20.providers/alwaysdata",{"title":121,"path":122,"stem":123},"AWS Lambda","/deploy/providers/aws","2.deploy/20.providers/aws",{"title":125,"path":126,"stem":127},"AWS Amplify","/deploy/providers/aws-amplify","2.deploy/20.providers/aws-amplify",{"title":129,"path":130,"stem":131},"Azure","/deploy/providers/azure","2.deploy/20.providers/azure",{"title":133,"path":134,"stem":135},"Cleavr","/deploy/providers/cleavr","2.deploy/20.providers/cleavr",{"title":137,"path":138,"stem":139},"Cloudflare","/deploy/providers/cloudflare","2.deploy/20.providers/cloudflare",{"title":141,"path":142,"stem":143},"Deno Deploy","/deploy/providers/deno-deploy","2.deploy/20.providers/deno-deploy",{"title":145,"path":146,"stem":147},"DigitalOcean","/deploy/providers/digitalocean","2.deploy/20.providers/digitalocean",{"title":149,"path":150,"stem":151},"Firebase","/deploy/providers/firebase","2.deploy/20.providers/firebase",{"title":153,"path":154,"stem":155},"Flightcontrol","/deploy/providers/flightcontrol","2.deploy/20.providers/flightcontrol",{"title":157,"path":158,"stem":159},"Genezio","/deploy/providers/genezio","2.deploy/20.providers/genezio",{"title":161,"path":162,"stem":163},"GitHub Pages","/deploy/providers/github-pages","2.deploy/20.providers/github-pages",{"title":165,"path":166,"stem":167},"GitLab Pages","/deploy/providers/gitlab-pages","2.deploy/20.providers/gitlab-pages",{"title":169,"path":170,"stem":171},"Heroku","/deploy/providers/heroku","2.deploy/20.providers/heroku",{"title":173,"path":174,"stem":175},"IIS","/deploy/providers/iis","2.deploy/20.providers/iis",{"title":177,"path":178,"stem":179},"Koyeb","/deploy/providers/koyeb","2.deploy/20.providers/koyeb",{"title":181,"path":182,"stem":183},"Netlify","/deploy/providers/netlify","2.deploy/20.providers/netlify",{"title":185,"path":186,"stem":187},"Platform.sh","/deploy/providers/platform-sh","2.deploy/20.providers/platform-sh",{"title":189,"path":190,"stem":191},"Render.com","/deploy/providers/render","2.deploy/20.providers/render",{"title":193,"path":194,"stem":195},"StormKit","/deploy/providers/stormkit","2.deploy/20.providers/stormkit",{"title":197,"path":198,"stem":199},"Vercel","/deploy/providers/vercel","2.deploy/20.providers/vercel",{"title":201,"path":202,"stem":203},"Zeabur","/deploy/providers/zeabur","2.deploy/20.providers/zeabur",{"title":205,"path":206,"stem":207},"Zephyr Cloud","/deploy/providers/zephyr","2.deploy/20.providers/zephyr",{"title":209,"path":210,"stem":211},"Zerops","/deploy/providers/zerops","2.deploy/20.providers/zerops",{"title":213,"path":214,"stem":215,"children":216,"icon":36},"Config","/config","3.config/0.index",[217],{"title":213,"path":214,"stem":215,"icon":36},{"title":219,"path":220,"stem":221,"children":222,"icon":224},"Examples","/examples","4.examples/0.index",[223,225,230,235,240,245,249,254,259,264,269,274,279,283,288,292,296,301,306,311,316,321,326,331,336,341,345,350,355,359,364,369],{"title":219,"path":220,"stem":221,"icon":224},"i-lucide-folder-code",{"title":226,"path":227,"stem":228,"icon":229},"API Routes","/examples/api-routes","4.examples/api-routes","i-lucide-route",{"title":231,"path":232,"stem":233,"icon":234},"Auto Imports","/examples/auto-imports","4.examples/auto-imports","i-lucide-import",{"title":236,"path":237,"stem":238,"icon":239},"Cached Handler","/examples/cached-handler","4.examples/cached-handler","i-lucide-clock",{"title":241,"path":242,"stem":243,"icon":244},"Custom Error Handler","/examples/custom-error-handler","4.examples/custom-error-handler","i-lucide-alert-circle",{"title":38,"path":246,"stem":247,"icon":248},"/examples/database","4.examples/database","i-lucide-database",{"title":250,"path":251,"stem":252,"icon":253},"Elysia","/examples/elysia","4.examples/elysia","i-skill-icons-elysia-dark",{"title":255,"path":256,"stem":257,"icon":258},"Express","/examples/express","4.examples/express","i-simple-icons-express",{"title":260,"path":261,"stem":262,"icon":263},"Fastify","/examples/fastify","4.examples/fastify","i-simple-icons-fastify",{"title":265,"path":266,"stem":267,"icon":268},"Hello World","/examples/hello-world","4.examples/hello-world","i-lucide-sparkles",{"title":270,"path":271,"stem":272,"icon":273},"Hono","/examples/hono","4.examples/hono","i-logos-hono",{"title":275,"path":276,"stem":277,"icon":278},"Import Alias","/examples/import-alias","4.examples/import-alias","i-lucide-at-sign",{"title":280,"path":281,"stem":282,"icon":46},"Middleware","/examples/middleware","4.examples/middleware",{"title":284,"path":285,"stem":286,"icon":287},"Mono JSX","/examples/mono-jsx","4.examples/mono-jsx","i-lucide-brackets",{"title":289,"path":290,"stem":291,"icon":287},"Nano JSX","/examples/nano-jsx","4.examples/nano-jsx",{"title":48,"path":293,"stem":294,"icon":295},"/examples/plugins","4.examples/plugins","i-lucide-plug",{"title":297,"path":298,"stem":299,"icon":300},"Custom Renderer","/examples/renderer","4.examples/renderer","i-lucide-code",{"title":302,"path":303,"stem":304,"icon":305},"Runtime Config","/examples/runtime-config","4.examples/runtime-config","i-lucide-settings",{"title":307,"path":308,"stem":309,"icon":310},"Server Fetch","/examples/server-fetch","4.examples/server-fetch","i-lucide-arrow-right-left",{"title":312,"path":313,"stem":314,"icon":315},"Shiki","/examples/shiki","4.examples/shiki","i-lucide-highlighter",{"title":317,"path":318,"stem":319,"icon":320},"Virtual Routes","/examples/virtual-routes","4.examples/virtual-routes","i-lucide-box",{"title":322,"path":323,"stem":324,"icon":325},"Vite Nitro Plugin","/examples/vite-nitro-plugin","4.examples/vite-nitro-plugin","i-logos-vitejs",{"title":327,"path":328,"stem":329,"icon":330},"Vite RSC","/examples/vite-rsc","4.examples/vite-rsc","i-logos-react",{"title":332,"path":333,"stem":334,"icon":335},"Vite SSR HTML","/examples/vite-ssr-html","4.examples/vite-ssr-html","i-logos-html-5",{"title":337,"path":338,"stem":339,"icon":340},"SSR with Preact","/examples/vite-ssr-preact","4.examples/vite-ssr-preact","i-logos-preact",{"title":342,"path":343,"stem":344,"icon":330},"SSR with React","/examples/vite-ssr-react","4.examples/vite-ssr-react",{"title":346,"path":347,"stem":348,"icon":349},"SSR with SolidJS","/examples/vite-ssr-solid","4.examples/vite-ssr-solid","i-logos-solidjs-icon",{"title":351,"path":352,"stem":353,"icon":354},"SSR with TanStack Router","/examples/vite-ssr-tsr-react","4.examples/vite-ssr-tsr-react","i-simple-icons-tanstack",{"title":356,"path":357,"stem":358,"icon":354},"SSR with TanStack Start","/examples/vite-ssr-tss-react","4.examples/vite-ssr-tss-react",{"title":360,"path":361,"stem":362,"icon":363},"SSR with Vue Router","/examples/vite-ssr-vue-router","4.examples/vite-ssr-vue-router","i-logos-vue",{"title":365,"path":366,"stem":367,"icon":368},"Vite + tRPC","/examples/vite-trpc","4.examples/vite-trpc","i-simple-icons-trpc",{"title":370,"path":371,"stem":372,"icon":373},"WebSocket","/examples/websocket","4.examples/websocket","i-lucide-radio",{"title":5,"path":375,"stem":376},"/","index",{"id":378,"title":379,"body":380,"description":1799,"extension":1678,"meta":1800,"navigation":1801,"path":59,"seo":1802,"stem":60,"__hash__":1803},"content/1.docs/6.server-entry.md","Nitro Server Entry",{"type":381,"value":382,"toc":1782,"icon":61},"minimark",[383,387,396,419,422,688,701,704,726,730,737,742,751,1015,1019,1057,1249,1252,1256,1263,1312,1323,1388,1392,1398,1422,1436,1440,1450,1492,1496,1503,1650,1660,1664,1674,1731,1734,1738,1741,1745,1778],[384,385,386],"p",{},"The server entry is a special handler in Nitro that acts as a global middleware, running for every incoming request before routes are matched. It's commonly used for cross-cutting concerns like authentication, logging, request preprocessing, or creating custom routing logic.",[388,389,391,392],"h2",{"id":390},"auto-detected-serverts","Auto-detected ",[393,394,395],"code",{},"server.ts",[384,397,398,399,401,402,405,406,405,409,405,412,405,415,418],{},"By default, Nitro automatically looks for a ",[393,400,395],{}," (or ",[393,403,404],{},".js",", ",[393,407,408],{},".mjs",[393,410,411],{},".mts",[393,413,414],{},".tsx",[393,416,417],{},".jsx",") file in your project root directory.",[384,420,421],{},"If found, Nitro will use it as the server entry and run it for all incoming requests.",[423,424,425,619],"code-group",{},[426,427,431],"pre",{"className":428,"code":429,"filename":395,"language":430,"meta":5,"style":5},"language-ts shiki shiki-themes github-light github-dark github-dark","export default {\n  async fetch(req: Request) {\n    const url = new URL(req.url);\n\n    // Handle specific routes\n    if (url.pathname === \"/health\") {\n      return new Response(\"OK\", {\n        status: 200,\n        headers: { \"content-type\": \"text/plain\" }\n      });\n    }\n\n    // Add custom headers to all requests\n    // Return nothing to continue to the next handler\n  }\n}\n","ts",[393,432,433,449,475,497,504,511,529,548,560,578,584,590,595,601,607,613],{"__ignoreMap":5},[434,435,438,442,445],"span",{"class":436,"line":437},"line",1,[434,439,441],{"class":440},"so5gQ","export",[434,443,444],{"class":440}," default",[434,446,448],{"class":447},"slsVL"," {\n",[434,450,452,455,459,462,466,469,472],{"class":436,"line":451},2,[434,453,454],{"class":440},"  async",[434,456,458],{"class":457},"shcOC"," fetch",[434,460,461],{"class":447},"(",[434,463,465],{"class":464},"sQHwn","req",[434,467,468],{"class":440},":",[434,470,471],{"class":457}," Request",[434,473,474],{"class":447},") {\n",[434,476,478,481,485,488,491,494],{"class":436,"line":477},3,[434,479,480],{"class":440},"    const",[434,482,484],{"class":483},"suiK_"," url",[434,486,487],{"class":440}," =",[434,489,490],{"class":440}," new",[434,492,493],{"class":457}," URL",[434,495,496],{"class":447},"(req.url);\n",[434,498,500],{"class":436,"line":499},4,[434,501,503],{"emptyLinePlaceholder":502},true,"\n",[434,505,507],{"class":436,"line":506},5,[434,508,510],{"class":509},"sCsY4","    // Handle specific routes\n",[434,512,514,517,520,523,527],{"class":436,"line":513},6,[434,515,516],{"class":440},"    if",[434,518,519],{"class":447}," (url.pathname ",[434,521,522],{"class":440},"===",[434,524,526],{"class":525},"sfrk1"," \"/health\"",[434,528,474],{"class":447},[434,530,532,535,537,540,542,545],{"class":436,"line":531},7,[434,533,534],{"class":440},"      return",[434,536,490],{"class":440},[434,538,539],{"class":457}," Response",[434,541,461],{"class":447},[434,543,544],{"class":525},"\"OK\"",[434,546,547],{"class":447},", {\n",[434,549,551,554,557],{"class":436,"line":550},8,[434,552,553],{"class":447},"        status: ",[434,555,556],{"class":483},"200",[434,558,559],{"class":447},",\n",[434,561,563,566,569,572,575],{"class":436,"line":562},9,[434,564,565],{"class":447},"        headers: { ",[434,567,568],{"class":525},"\"content-type\"",[434,570,571],{"class":447},": ",[434,573,574],{"class":525},"\"text/plain\"",[434,576,577],{"class":447}," }\n",[434,579,581],{"class":436,"line":580},10,[434,582,583],{"class":447},"      });\n",[434,585,587],{"class":436,"line":586},11,[434,588,589],{"class":447},"    }\n",[434,591,593],{"class":436,"line":592},12,[434,594,503],{"emptyLinePlaceholder":502},[434,596,598],{"class":436,"line":597},13,[434,599,600],{"class":509},"    // Add custom headers to all requests\n",[434,602,604],{"class":436,"line":603},14,[434,605,606],{"class":509},"    // Return nothing to continue to the next handler\n",[434,608,610],{"class":436,"line":609},15,[434,611,612],{"class":447},"  }\n",[434,614,616],{"class":436,"line":615},16,[434,617,618],{"class":447},"}\n",[426,620,623],{"className":428,"code":621,"filename":622,"language":430,"meta":5,"style":5},"import { defineHandler } from \"nitro\";\n\nexport default defineHandler((event) => {\n  return { hello: \"API\" };\n});\n","routes/api/hello.ts",[393,624,625,642,646,669,683],{"__ignoreMap":5},[434,626,627,630,633,636,639],{"class":436,"line":437},[434,628,629],{"class":440},"import",[434,631,632],{"class":447}," { defineHandler } ",[434,634,635],{"class":440},"from",[434,637,638],{"class":525}," \"nitro\"",[434,640,641],{"class":447},";\n",[434,643,644],{"class":436,"line":451},[434,645,503],{"emptyLinePlaceholder":502},[434,647,648,650,652,655,658,661,664,667],{"class":436,"line":477},[434,649,441],{"class":440},[434,651,444],{"class":440},[434,653,654],{"class":457}," defineHandler",[434,656,657],{"class":447},"((",[434,659,660],{"class":464},"event",[434,662,663],{"class":447},") ",[434,665,666],{"class":440},"=>",[434,668,448],{"class":447},[434,670,671,674,677,680],{"class":436,"line":499},[434,672,673],{"class":440},"  return",[434,675,676],{"class":447}," { hello: ",[434,678,679],{"class":525},"\"API\"",[434,681,682],{"class":447}," };\n",[434,684,685],{"class":436,"line":506},[434,686,687],{"class":447},"});\n",[689,690,691],"tip",{},[384,692,693,694,696,697,700],{},"When ",[393,695,395],{}," is detected, Nitro will log in the terminal: ",[393,698,699],{},"Detected \\","server.ts` as server entry.`",[384,702,703],{},"With this setup:",[705,706,707,714,720],"ul",{},[708,709,710,713],"li",{},[393,711,712],{},"/health"," → Handled by server entry (returns a response)",[708,715,716,719],{},[393,717,718],{},"/api/hello"," → Handled by the API route handler directly",[708,721,722,725],{},[393,723,724],{},"/about",", etc. → Server entry runs first, then continues to the renderer if no response is returned",[388,727,729],{"id":728},"framework-compatibility","Framework compatibility",[384,731,732,733,736],{},"The server entry is a great way to integrate with other frameworks. Any framework that exposes a standard Web ",[393,734,735],{},"fetch(request: Request): Response"," interface can be used as a server entry.",[738,739,741],"h3",{"id":740},"web-compatible-frameworks","Web-compatible frameworks",[384,743,744,745,748,749,468],{},"Frameworks that implement the Web ",[393,746,747],{},"fetch"," API work directly with ",[393,750,395],{},[752,753,754,841,933],"tabs",{},[755,756,759],"tabs-item",{"label":757,"icon":758},"H3","i-undocs-h3",[426,760,762],{"className":428,"code":761,"filename":395,"language":430,"meta":5,"style":5},"import { H3 } from \"h3\";\n\nconst app = new H3()\n\napp.get(\"/\", () => \"⚡️ Hello from H3!\");\n\nexport default app;\n",[393,763,764,778,782,800,804,828,832],{"__ignoreMap":5},[434,765,766,768,771,773,776],{"class":436,"line":437},[434,767,629],{"class":440},[434,769,770],{"class":447}," { H3 } ",[434,772,635],{"class":440},[434,774,775],{"class":525}," \"h3\"",[434,777,641],{"class":447},[434,779,780],{"class":436,"line":451},[434,781,503],{"emptyLinePlaceholder":502},[434,783,784,787,790,792,794,797],{"class":436,"line":477},[434,785,786],{"class":440},"const",[434,788,789],{"class":483}," app",[434,791,487],{"class":440},[434,793,490],{"class":440},[434,795,796],{"class":457}," H3",[434,798,799],{"class":447},"()\n",[434,801,802],{"class":436,"line":499},[434,803,503],{"emptyLinePlaceholder":502},[434,805,806,809,812,814,817,820,822,825],{"class":436,"line":506},[434,807,808],{"class":447},"app.",[434,810,811],{"class":457},"get",[434,813,461],{"class":447},[434,815,816],{"class":525},"\"/\"",[434,818,819],{"class":447},", () ",[434,821,666],{"class":440},[434,823,824],{"class":525}," \"⚡️ Hello from H3!\"",[434,826,827],{"class":447},");\n",[434,829,830],{"class":436,"line":513},[434,831,503],{"emptyLinePlaceholder":502},[434,833,834,836,838],{"class":436,"line":531},[434,835,441],{"class":440},[434,837,444],{"class":440},[434,839,840],{"class":447}," app;\n",[755,842,844],{"label":270,"icon":843},"i-undocs-hono",[426,845,847],{"className":428,"code":846,"filename":395,"language":430,"meta":5,"style":5},"import { Hono } from \"hono\";\n\nconst app = new Hono();\n\napp.get(\"/\", (c) => c.text(\"🔥 Hello from Hono!\"));\n\nexport default app;\n",[393,848,849,863,867,883,887,921,925],{"__ignoreMap":5},[434,850,851,853,856,858,861],{"class":436,"line":437},[434,852,629],{"class":440},[434,854,855],{"class":447}," { Hono } ",[434,857,635],{"class":440},[434,859,860],{"class":525}," \"hono\"",[434,862,641],{"class":447},[434,864,865],{"class":436,"line":451},[434,866,503],{"emptyLinePlaceholder":502},[434,868,869,871,873,875,877,880],{"class":436,"line":477},[434,870,786],{"class":440},[434,872,789],{"class":483},[434,874,487],{"class":440},[434,876,490],{"class":440},[434,878,879],{"class":457}," Hono",[434,881,882],{"class":447},"();\n",[434,884,885],{"class":436,"line":499},[434,886,503],{"emptyLinePlaceholder":502},[434,888,889,891,893,895,897,900,903,905,907,910,913,915,918],{"class":436,"line":506},[434,890,808],{"class":447},[434,892,811],{"class":457},[434,894,461],{"class":447},[434,896,816],{"class":525},[434,898,899],{"class":447},", (",[434,901,902],{"class":464},"c",[434,904,663],{"class":447},[434,906,666],{"class":440},[434,908,909],{"class":447}," c.",[434,911,912],{"class":457},"text",[434,914,461],{"class":447},[434,916,917],{"class":525},"\"🔥 Hello from Hono!\"",[434,919,920],{"class":447},"));\n",[434,922,923],{"class":436,"line":513},[434,924,503],{"emptyLinePlaceholder":502},[434,926,927,929,931],{"class":436,"line":531},[434,928,441],{"class":440},[434,930,444],{"class":440},[434,932,840],{"class":447},[755,934,936],{"label":250,"icon":935},"i-undocs-elysia",[426,937,939],{"className":428,"code":938,"filename":395,"language":430,"meta":5,"style":5},"import { Elysia } from \"elysia\";\n\nconst app = new Elysia();\n\napp.get(\"/\", () => \"🦊 Hello from Elysia!\");\n\nexport default app.compile();\n",[393,940,941,955,959,974,978,997,1001],{"__ignoreMap":5},[434,942,943,945,948,950,953],{"class":436,"line":437},[434,944,629],{"class":440},[434,946,947],{"class":447}," { Elysia } ",[434,949,635],{"class":440},[434,951,952],{"class":525}," \"elysia\"",[434,954,641],{"class":447},[434,956,957],{"class":436,"line":451},[434,958,503],{"emptyLinePlaceholder":502},[434,960,961,963,965,967,969,972],{"class":436,"line":477},[434,962,786],{"class":440},[434,964,789],{"class":483},[434,966,487],{"class":440},[434,968,490],{"class":440},[434,970,971],{"class":457}," Elysia",[434,973,882],{"class":447},[434,975,976],{"class":436,"line":499},[434,977,503],{"emptyLinePlaceholder":502},[434,979,980,982,984,986,988,990,992,995],{"class":436,"line":506},[434,981,808],{"class":447},[434,983,811],{"class":457},[434,985,461],{"class":447},[434,987,816],{"class":525},[434,989,819],{"class":447},[434,991,666],{"class":440},[434,993,994],{"class":525}," \"🦊 Hello from Elysia!\"",[434,996,827],{"class":447},[434,998,999],{"class":436,"line":513},[434,1000,503],{"emptyLinePlaceholder":502},[434,1002,1003,1005,1007,1010,1013],{"class":436,"line":531},[434,1004,441],{"class":440},[434,1006,444],{"class":440},[434,1008,1009],{"class":447}," app.",[434,1011,1012],{"class":457},"compile",[434,1014,882],{"class":447},[738,1016,1018],{"id":1017},"nodejs-frameworks","Node.js frameworks",[384,1020,1021,1022,1025,1026,1032,1033,1037,1038,1041,1042,1044,1045,1048,1049,1056],{},"For Node.js frameworks that use ",[393,1023,1024],{},"(req, res)"," style handlers (like ",[1027,1028,255],"a",{"href":1029,"rel":1030},"https://expressjs.com/",[1031],"nofollow"," or ",[1027,1034,260],{"href":1035,"rel":1036},"https://fastify.dev/",[1031],"), name your server entry file ",[393,1039,1040],{},"server.node.ts"," instead of ",[393,1043,395],{},". Nitro will automatically detect the ",[393,1046,1047],{},".node."," suffix and convert the Node.js handler to a web-compatible fetch handler using ",[1027,1050,1053],{"href":1051,"rel":1052},"https://srvx.h3.dev/",[1031],[393,1054,1055],{},"srvx",".",[752,1058,1059,1159],{},[755,1060,1061],{"label":255},[426,1062,1064],{"className":428,"code":1063,"filename":1040,"language":430,"meta":5,"style":5},"import Express from \"express\";\n\nconst app = Express();\n\napp.use(\"/\", (_req, res) => {\n  res.send(\"Hello from Express with Nitro!\");\n});\n\nexport default app;\n",[393,1065,1066,1080,1084,1097,1101,1128,1143,1147,1151],{"__ignoreMap":5},[434,1067,1068,1070,1073,1075,1078],{"class":436,"line":437},[434,1069,629],{"class":440},[434,1071,1072],{"class":447}," Express ",[434,1074,635],{"class":440},[434,1076,1077],{"class":525}," \"express\"",[434,1079,641],{"class":447},[434,1081,1082],{"class":436,"line":451},[434,1083,503],{"emptyLinePlaceholder":502},[434,1085,1086,1088,1090,1092,1095],{"class":436,"line":477},[434,1087,786],{"class":440},[434,1089,789],{"class":483},[434,1091,487],{"class":440},[434,1093,1094],{"class":457}," Express",[434,1096,882],{"class":447},[434,1098,1099],{"class":436,"line":499},[434,1100,503],{"emptyLinePlaceholder":502},[434,1102,1103,1105,1108,1110,1112,1114,1117,1119,1122,1124,1126],{"class":436,"line":506},[434,1104,808],{"class":447},[434,1106,1107],{"class":457},"use",[434,1109,461],{"class":447},[434,1111,816],{"class":525},[434,1113,899],{"class":447},[434,1115,1116],{"class":464},"_req",[434,1118,405],{"class":447},[434,1120,1121],{"class":464},"res",[434,1123,663],{"class":447},[434,1125,666],{"class":440},[434,1127,448],{"class":447},[434,1129,1130,1133,1136,1138,1141],{"class":436,"line":513},[434,1131,1132],{"class":447},"  res.",[434,1134,1135],{"class":457},"send",[434,1137,461],{"class":447},[434,1139,1140],{"class":525},"\"Hello from Express with Nitro!\"",[434,1142,827],{"class":447},[434,1144,1145],{"class":436,"line":531},[434,1146,687],{"class":447},[434,1148,1149],{"class":436,"line":550},[434,1150,503],{"emptyLinePlaceholder":502},[434,1152,1153,1155,1157],{"class":436,"line":562},[434,1154,441],{"class":440},[434,1156,444],{"class":440},[434,1158,840],{"class":447},[755,1160,1161],{"label":260},[426,1162,1164],{"className":428,"code":1163,"filename":1040,"language":430,"meta":5,"style":5},"import Fastify from \"fastify\";\n\nconst app = Fastify();\n\napp.get(\"/\", () => \"Hello, Fastify with Nitro!\");\n\nawait app.ready();\n\nexport default app.routing;\n",[393,1165,1166,1180,1184,1197,1201,1220,1224,1236,1240],{"__ignoreMap":5},[434,1167,1168,1170,1173,1175,1178],{"class":436,"line":437},[434,1169,629],{"class":440},[434,1171,1172],{"class":447}," Fastify ",[434,1174,635],{"class":440},[434,1176,1177],{"class":525}," \"fastify\"",[434,1179,641],{"class":447},[434,1181,1182],{"class":436,"line":451},[434,1183,503],{"emptyLinePlaceholder":502},[434,1185,1186,1188,1190,1192,1195],{"class":436,"line":477},[434,1187,786],{"class":440},[434,1189,789],{"class":483},[434,1191,487],{"class":440},[434,1193,1194],{"class":457}," Fastify",[434,1196,882],{"class":447},[434,1198,1199],{"class":436,"line":499},[434,1200,503],{"emptyLinePlaceholder":502},[434,1202,1203,1205,1207,1209,1211,1213,1215,1218],{"class":436,"line":506},[434,1204,808],{"class":447},[434,1206,811],{"class":457},[434,1208,461],{"class":447},[434,1210,816],{"class":525},[434,1212,819],{"class":447},[434,1214,666],{"class":440},[434,1216,1217],{"class":525}," \"Hello, Fastify with Nitro!\"",[434,1219,827],{"class":447},[434,1221,1222],{"class":436,"line":513},[434,1223,503],{"emptyLinePlaceholder":502},[434,1225,1226,1229,1231,1234],{"class":436,"line":531},[434,1227,1228],{"class":440},"await",[434,1230,1009],{"class":447},[434,1232,1233],{"class":457},"ready",[434,1235,882],{"class":447},[434,1237,1238],{"class":436,"line":550},[434,1239,503],{"emptyLinePlaceholder":502},[434,1241,1242,1244,1246],{"class":436,"line":562},[434,1243,441],{"class":440},[434,1245,444],{"class":440},[434,1247,1248],{"class":447}," app.routing;\n",[388,1250,33],{"id":1251},"configuration",[738,1253,1255],{"id":1254},"custom-server-entry-file","Custom server entry file",[384,1257,1258,1259,1262],{},"You can specify a custom server entry file using the ",[393,1260,1261],{},"serverEntry"," option in your Nitro configuration:",[426,1264,1267],{"className":428,"code":1265,"filename":1266,"language":430,"meta":5,"style":5},"import { defineNitroConfig } from \"nitro/config\";\n\nexport default defineNitroConfig({\n  serverEntry: \"./nitro.server.ts\"\n})\n","nitro.config.ts",[393,1268,1269,1283,1287,1299,1307],{"__ignoreMap":5},[434,1270,1271,1273,1276,1278,1281],{"class":436,"line":437},[434,1272,629],{"class":440},[434,1274,1275],{"class":447}," { defineNitroConfig } ",[434,1277,635],{"class":440},[434,1279,1280],{"class":525}," \"nitro/config\"",[434,1282,641],{"class":447},[434,1284,1285],{"class":436,"line":451},[434,1286,503],{"emptyLinePlaceholder":502},[434,1288,1289,1291,1293,1296],{"class":436,"line":477},[434,1290,441],{"class":440},[434,1292,444],{"class":440},[434,1294,1295],{"class":457}," defineNitroConfig",[434,1297,1298],{"class":447},"({\n",[434,1300,1301,1304],{"class":436,"line":499},[434,1302,1303],{"class":447},"  serverEntry: ",[434,1305,1306],{"class":525},"\"./nitro.server.ts\"\n",[434,1308,1309],{"class":436,"line":506},[434,1310,1311],{"class":447},"})\n",[384,1313,1314,1315,1318,1319,1322],{},"You can also provide an object with ",[393,1316,1317],{},"handler"," and ",[393,1320,1321],{},"format"," options:",[426,1324,1326],{"className":428,"code":1325,"filename":1266,"language":430,"meta":5,"style":5},"import { defineNitroConfig } from \"nitro/config\";\n\nexport default defineNitroConfig({\n  serverEntry: {\n    handler: \"./server.ts\",\n    format: \"node\" // \"web\" (default) or \"node\"\n  }\n})\n",[393,1327,1328,1340,1344,1354,1359,1369,1380,1384],{"__ignoreMap":5},[434,1329,1330,1332,1334,1336,1338],{"class":436,"line":437},[434,1331,629],{"class":440},[434,1333,1275],{"class":447},[434,1335,635],{"class":440},[434,1337,1280],{"class":525},[434,1339,641],{"class":447},[434,1341,1342],{"class":436,"line":451},[434,1343,503],{"emptyLinePlaceholder":502},[434,1345,1346,1348,1350,1352],{"class":436,"line":477},[434,1347,441],{"class":440},[434,1349,444],{"class":440},[434,1351,1295],{"class":457},[434,1353,1298],{"class":447},[434,1355,1356],{"class":436,"line":499},[434,1357,1358],{"class":447},"  serverEntry: {\n",[434,1360,1361,1364,1367],{"class":436,"line":506},[434,1362,1363],{"class":447},"    handler: ",[434,1365,1366],{"class":525},"\"./server.ts\"",[434,1368,559],{"class":447},[434,1370,1371,1374,1377],{"class":436,"line":513},[434,1372,1373],{"class":447},"    format: ",[434,1375,1376],{"class":525},"\"node\"",[434,1378,1379],{"class":509}," // \"web\" (default) or \"node\"\n",[434,1381,1382],{"class":436,"line":531},[434,1383,612],{"class":447},[434,1385,1386],{"class":436,"line":550},[434,1387,1311],{"class":447},[738,1389,1391],{"id":1390},"handler-format","Handler format",[384,1393,1394,1395,1397],{},"The ",[393,1396,1321],{}," option controls how Nitro treats the default export of your server entry:",[705,1399,1400,1412],{},[708,1401,1402,1408,1409,1411],{},[1403,1404,1405],"strong",{},[393,1406,1407],{},"\"web\""," (default) — Expects a Web-compatible handler with a ",[393,1410,735],{}," method.",[708,1413,1414,1418,1419,1421],{},[1403,1415,1416],{},[393,1417,1376],{}," — Expects a Node.js-style ",[393,1420,1024],{}," handler. Nitro automatically converts it to a web-compatible handler.",[384,1423,1424,1425,1427,1428,1430,1431,1427,1433,1435],{},"When auto-detecting, the format is determined by the filename: ",[393,1426,1040],{}," uses ",[393,1429,1376],{}," format, while ",[393,1432,395],{},[393,1434,1407],{}," format.",[738,1437,1439],{"id":1438},"disabling-server-entry","Disabling server entry",[384,1441,1442,1443,1445,1446,1449],{},"Set ",[393,1444,1261],{}," to ",[393,1447,1448],{},"false"," to disable auto-detection and prevent Nitro from using any server entry:",[426,1451,1453],{"className":428,"code":1452,"filename":1266,"language":430,"meta":5,"style":5},"import { defineNitroConfig } from \"nitro/config\";\n\nexport default defineNitroConfig({\n  serverEntry: false\n})\n",[393,1454,1455,1467,1471,1481,1488],{"__ignoreMap":5},[434,1456,1457,1459,1461,1463,1465],{"class":436,"line":437},[434,1458,629],{"class":440},[434,1460,1275],{"class":447},[434,1462,635],{"class":440},[434,1464,1280],{"class":525},[434,1466,641],{"class":447},[434,1468,1469],{"class":436,"line":451},[434,1470,503],{"emptyLinePlaceholder":502},[434,1472,1473,1475,1477,1479],{"class":436,"line":477},[434,1474,441],{"class":440},[434,1476,444],{"class":440},[434,1478,1295],{"class":457},[434,1480,1298],{"class":447},[434,1482,1483,1485],{"class":436,"line":499},[434,1484,1303],{"class":447},[434,1486,1487],{"class":483},"false\n",[434,1489,1490],{"class":436,"line":506},[434,1491,1311],{"class":447},[388,1493,1495],{"id":1494},"using-event-handler","Using event handler",[384,1497,1498,1499,1502],{},"You can also export an event handler using ",[393,1500,1501],{},"defineHandler"," for better type inference and access to the h3 event object:",[426,1504,1506],{"className":428,"code":1505,"filename":395,"language":430,"meta":5,"style":5},"import { defineHandler } from \"nitro\";\n\nexport default defineHandler((event) => {\n  // Add custom context\n  event.context.requestId = crypto.randomUUID();\n  event.context.timestamp = Date.now();\n\n  // Log the request\n  console.log(`[${event.context.requestId}] ${event.method} ${event.path}`);\n\n  // Continue to the next handler (don't return anything)\n});\n",[393,1507,1508,1520,1524,1542,1547,1563,1578,1582,1587,1637,1641,1646],{"__ignoreMap":5},[434,1509,1510,1512,1514,1516,1518],{"class":436,"line":437},[434,1511,629],{"class":440},[434,1513,632],{"class":447},[434,1515,635],{"class":440},[434,1517,638],{"class":525},[434,1519,641],{"class":447},[434,1521,1522],{"class":436,"line":451},[434,1523,503],{"emptyLinePlaceholder":502},[434,1525,1526,1528,1530,1532,1534,1536,1538,1540],{"class":436,"line":477},[434,1527,441],{"class":440},[434,1529,444],{"class":440},[434,1531,654],{"class":457},[434,1533,657],{"class":447},[434,1535,660],{"class":464},[434,1537,663],{"class":447},[434,1539,666],{"class":440},[434,1541,448],{"class":447},[434,1543,1544],{"class":436,"line":499},[434,1545,1546],{"class":509},"  // Add custom context\n",[434,1548,1549,1552,1555,1558,1561],{"class":436,"line":506},[434,1550,1551],{"class":447},"  event.context.requestId ",[434,1553,1554],{"class":440},"=",[434,1556,1557],{"class":447}," crypto.",[434,1559,1560],{"class":457},"randomUUID",[434,1562,882],{"class":447},[434,1564,1565,1568,1570,1573,1576],{"class":436,"line":513},[434,1566,1567],{"class":447},"  event.context.timestamp ",[434,1569,1554],{"class":440},[434,1571,1572],{"class":447}," Date.",[434,1574,1575],{"class":457},"now",[434,1577,882],{"class":447},[434,1579,1580],{"class":436,"line":531},[434,1581,503],{"emptyLinePlaceholder":502},[434,1583,1584],{"class":436,"line":550},[434,1585,1586],{"class":509},"  // Log the request\n",[434,1588,1589,1592,1595,1597,1600,1602,1604,1607,1609,1612,1615,1617,1619,1622,1625,1627,1629,1632,1635],{"class":436,"line":562},[434,1590,1591],{"class":447},"  console.",[434,1593,1594],{"class":457},"log",[434,1596,461],{"class":447},[434,1598,1599],{"class":525},"`[${",[434,1601,660],{"class":447},[434,1603,1056],{"class":525},[434,1605,1606],{"class":447},"context",[434,1608,1056],{"class":525},[434,1610,1611],{"class":447},"requestId",[434,1613,1614],{"class":525},"}] ${",[434,1616,660],{"class":447},[434,1618,1056],{"class":525},[434,1620,1621],{"class":447},"method",[434,1623,1624],{"class":525},"} ${",[434,1626,660],{"class":447},[434,1628,1056],{"class":525},[434,1630,1631],{"class":447},"path",[434,1633,1634],{"class":525},"}`",[434,1636,827],{"class":447},[434,1638,1639],{"class":436,"line":580},[434,1640,503],{"emptyLinePlaceholder":502},[434,1642,1643],{"class":436,"line":586},[434,1644,1645],{"class":509},"  // Continue to the next handler (don't return anything)\n",[434,1647,1648],{"class":436,"line":592},[434,1649,687],{"class":447},[1651,1652,1653],"important",{},[384,1654,1655,1656,1659],{},"If your server entry returns ",[393,1657,1658],{},"undefined"," or doesn't return anything, the request will continue to be processed by routes and the renderer. If it returns a response, the request lifecycle stops there.",[388,1661,1663],{"id":1662},"request-lifecycle","Request lifecycle",[384,1665,1666,1667,1670,1671,1673],{},"The server entry is registered as a catch-all (",[393,1668,1669],{},"/**",") route handler. When a specific route (like ",[393,1672,718],{},") matches a request, that route handler takes priority. For requests that don't match any specific route, the server entry runs before the renderer:",[426,1675,1679],{"className":1676,"code":1677,"language":1678,"meta":5,"style":5},"language-md shiki shiki-themes github-light github-dark github-dark","1. Server hook: `request`\n2. Route rules (headers, redirects, etc.)\n3. Global middleware (middleware/)\n4. Route matching:\n   a. Specific routes (routes/) ← if matched, handles the request\n   b. Server entry ← runs for unmatched routes\n   c. Renderer (renderer.ts or index.html)\n","md",[393,1680,1681,1692,1700,1708,1716,1721,1726],{"__ignoreMap":5},[434,1682,1683,1686,1689],{"class":436,"line":437},[434,1684,1685],{"class":464},"1.",[434,1687,1688],{"class":447}," Server hook: ",[434,1690,1691],{"class":483},"`request`\n",[434,1693,1694,1697],{"class":436,"line":451},[434,1695,1696],{"class":464},"2.",[434,1698,1699],{"class":447}," Route rules (headers, redirects, etc.)\n",[434,1701,1702,1705],{"class":436,"line":477},[434,1703,1704],{"class":464},"3.",[434,1706,1707],{"class":447}," Global middleware (middleware/)\n",[434,1709,1710,1713],{"class":436,"line":499},[434,1711,1712],{"class":464},"4.",[434,1714,1715],{"class":447}," Route matching:\n",[434,1717,1718],{"class":436,"line":506},[434,1719,1720],{"class":447},"   a. Specific routes (routes/) ← if matched, handles the request\n",[434,1722,1723],{"class":436,"line":513},[434,1724,1725],{"class":447},"   b. Server entry ← runs for unmatched routes\n",[434,1727,1728],{"class":436,"line":531},[434,1729,1730],{"class":447},"   c. Renderer (renderer.ts or index.html)\n",[384,1732,1733],{},"When both a server entry and a renderer exist, they are chained: the server entry runs first, and if it doesn't return a response, the renderer handles the request.",[388,1735,1737],{"id":1736},"development-mode","Development mode",[384,1739,1740],{},"During development, Nitro watches for changes to your server entry file. When the file is created, modified, or deleted, the dev server automatically reloads to pick up the changes.",[388,1742,1744],{"id":1743},"best-practices","Best practices",[705,1746,1747,1753,1759,1762,1765,1772,1775],{},[708,1748,1749,1750],{},"Use server entry for cross-cutting concerns that affect ",[1403,1751,1752],{},"all routes",[708,1754,1755,1756,1758],{},"Return ",[393,1757,1658],{}," to continue processing, return a response to terminate",[708,1760,1761],{},"Keep server entry logic lightweight for better performance",[708,1763,1764],{},"Use global middleware for modular concerns instead of one large server entry",[708,1766,1767,1768,1771],{},"Consider using ",[1027,1769,1770],{"href":49},"Nitro plugins"," for initialization logic",[708,1773,1774],{},"Avoid heavy computation in server entry (it runs for every request)",[708,1776,1777],{},"Don't use server entry for route-specific logic (use route handlers instead as they are more performant)",[1779,1780,1781],"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 .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 pre.shiki code .suiK_, html code.shiki .suiK_{--shiki-light:#005CC5;--shiki-default:#79B8FF;--shiki-dark:#79B8FF}html pre.shiki code .sCsY4, html code.shiki .sCsY4{--shiki-light:#6A737D;--shiki-default:#6A737D;--shiki-dark:#6A737D}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);}",{"title":5,"searchDepth":451,"depth":451,"links":1783},[1784,1786,1790,1795,1796,1797,1798],{"id":390,"depth":451,"text":1785},"Auto-detected server.ts",{"id":728,"depth":451,"text":729,"children":1787},[1788,1789],{"id":740,"depth":477,"text":741},{"id":1017,"depth":477,"text":1018},{"id":1251,"depth":451,"text":33,"children":1791},[1792,1793,1794],{"id":1254,"depth":477,"text":1255},{"id":1390,"depth":477,"text":1391},{"id":1438,"depth":477,"text":1439},{"id":1494,"depth":451,"text":1495},{"id":1662,"depth":451,"text":1663},{"id":1736,"depth":451,"text":1737},{"id":1743,"depth":451,"text":1744},"Use a server entry to create a global middleware that runs for all routes before they are matched.",{"icon":61},{"title":58,"icon":61},{"title":379,"description":1799},"GdDtp7gaHNS07AyAb7r075qXuPmUG2u-CJzj6QysIVI",[1805,1807],{"title":53,"path":54,"stem":55,"description":1806,"icon":56,"children":-1},"Nitro tasks allow on-off operations in runtime.",{"title":63,"path":64,"stem":65,"description":1808,"icon":66,"children":-1},"Nitro provides a caching system built on top of the storage layer, powered by ocache.",1773242036481]