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