[{"data":1,"prerenderedAt":1821},["ShallowReactive",2],{"navigation":3,"-docs-server-entry":389,"-docs-server-entry-surround":1816},[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":1811,"extension":1690,"meta":1812,"navigation":1813,"path":59,"seo":1814,"stem":60,"__hash__":1815},"content/1.docs/6.server-entry.md","Nitro Server Entry",{"type":393,"value":394,"toc":1794,"icon":61},"minimark",[395,399,408,431,434,700,713,716,738,742,749,754,763,1027,1031,1069,1261,1264,1268,1275,1324,1335,1400,1404,1410,1434,1448,1452,1462,1504,1508,1515,1662,1672,1676,1686,1743,1746,1750,1753,1757,1790],[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 { defineNitroConfig } from \"nitro/config\";\n\nexport default defineNitroConfig({\n  serverEntry: \"./nitro.server.ts\"\n})\n","nitro.config.ts",[405,1280,1281,1295,1299,1311,1319],{"__ignoreMap":5},[446,1282,1283,1285,1288,1290,1293],{"class":448,"line":449},[446,1284,641],{"class":452},[446,1286,1287],{"class":459}," { defineNitroConfig } ",[446,1289,647],{"class":452},[446,1291,1292],{"class":537}," \"nitro/config\"",[446,1294,653],{"class":459},[446,1296,1297],{"class":448,"line":463},[446,1298,515],{"emptyLinePlaceholder":514},[446,1300,1301,1303,1305,1308],{"class":448,"line":489},[446,1302,453],{"class":452},[446,1304,456],{"class":452},[446,1306,1307],{"class":469}," defineNitroConfig",[446,1309,1310],{"class":459},"({\n",[446,1312,1313,1316],{"class":448,"line":511},[446,1314,1315],{"class":459},"  serverEntry: ",[446,1317,1318],{"class":537},"\"./nitro.server.ts\"\n",[446,1320,1321],{"class":448,"line":518},[446,1322,1323],{"class":459},"})\n",[396,1325,1326,1327,1330,1331,1334],{},"You can also provide an object with ",[405,1328,1329],{},"handler"," and ",[405,1332,1333],{},"format"," options:",[438,1336,1338],{"className":440,"code":1337,"filename":1278,"language":442,"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",[405,1339,1340,1352,1356,1366,1371,1381,1392,1396],{"__ignoreMap":5},[446,1341,1342,1344,1346,1348,1350],{"class":448,"line":449},[446,1343,641],{"class":452},[446,1345,1287],{"class":459},[446,1347,647],{"class":452},[446,1349,1292],{"class":537},[446,1351,653],{"class":459},[446,1353,1354],{"class":448,"line":463},[446,1355,515],{"emptyLinePlaceholder":514},[446,1357,1358,1360,1362,1364],{"class":448,"line":489},[446,1359,453],{"class":452},[446,1361,456],{"class":452},[446,1363,1307],{"class":469},[446,1365,1310],{"class":459},[446,1367,1368],{"class":448,"line":511},[446,1369,1370],{"class":459},"  serverEntry: {\n",[446,1372,1373,1376,1379],{"class":448,"line":518},[446,1374,1375],{"class":459},"    handler: ",[446,1377,1378],{"class":537},"\"./server.ts\"",[446,1380,571],{"class":459},[446,1382,1383,1386,1389],{"class":448,"line":525},[446,1384,1385],{"class":459},"    format: ",[446,1387,1388],{"class":537},"\"node\"",[446,1390,1391],{"class":521}," // \"web\" (default) or \"node\"\n",[446,1393,1394],{"class":448,"line":543},[446,1395,624],{"class":459},[446,1397,1398],{"class":448,"line":562},[446,1399,1323],{"class":459},[750,1401,1403],{"id":1402},"handler-format","Handler format",[396,1405,1406,1407,1409],{},"The ",[405,1408,1333],{}," option controls how Nitro treats the default export of your server entry:",[717,1411,1412,1424],{},[720,1413,1414,1420,1421,1423],{},[1415,1416,1417],"strong",{},[405,1418,1419],{},"\"web\""," (default) — Expects a Web-compatible handler with a ",[405,1422,747],{}," method.",[720,1425,1426,1430,1431,1433],{},[1415,1427,1428],{},[405,1429,1388],{}," — Expects a Node.js-style ",[405,1432,1036],{}," handler. Nitro automatically converts it to a web-compatible handler.",[396,1435,1436,1437,1439,1440,1442,1443,1439,1445,1447],{},"When auto-detecting, the format is determined by the filename: ",[405,1438,1052],{}," uses ",[405,1441,1388],{}," format, while ",[405,1444,407],{},[405,1446,1419],{}," format.",[750,1449,1451],{"id":1450},"disabling-server-entry","Disabling server entry",[396,1453,1454,1455,1457,1458,1461],{},"Set ",[405,1456,1273],{}," to ",[405,1459,1460],{},"false"," to disable auto-detection and prevent Nitro from using any server entry:",[438,1463,1465],{"className":440,"code":1464,"filename":1278,"language":442,"meta":5,"style":5},"import { defineNitroConfig } from \"nitro/config\";\n\nexport default defineNitroConfig({\n  serverEntry: false\n})\n",[405,1466,1467,1479,1483,1493,1500],{"__ignoreMap":5},[446,1468,1469,1471,1473,1475,1477],{"class":448,"line":449},[446,1470,641],{"class":452},[446,1472,1287],{"class":459},[446,1474,647],{"class":452},[446,1476,1292],{"class":537},[446,1478,653],{"class":459},[446,1480,1481],{"class":448,"line":463},[446,1482,515],{"emptyLinePlaceholder":514},[446,1484,1485,1487,1489,1491],{"class":448,"line":489},[446,1486,453],{"class":452},[446,1488,456],{"class":452},[446,1490,1307],{"class":469},[446,1492,1310],{"class":459},[446,1494,1495,1497],{"class":448,"line":511},[446,1496,1315],{"class":459},[446,1498,1499],{"class":495},"false\n",[446,1501,1502],{"class":448,"line":518},[446,1503,1323],{"class":459},[400,1505,1507],{"id":1506},"using-event-handler","Using event handler",[396,1509,1510,1511,1514],{},"You can also export an event handler using ",[405,1512,1513],{},"defineHandler"," for better type inference and access to the h3 event object:",[438,1516,1518],{"className":440,"code":1517,"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,1519,1520,1532,1536,1554,1559,1575,1590,1594,1599,1649,1653,1658],{"__ignoreMap":5},[446,1521,1522,1524,1526,1528,1530],{"class":448,"line":449},[446,1523,641],{"class":452},[446,1525,644],{"class":459},[446,1527,647],{"class":452},[446,1529,650],{"class":537},[446,1531,653],{"class":459},[446,1533,1534],{"class":448,"line":463},[446,1535,515],{"emptyLinePlaceholder":514},[446,1537,1538,1540,1542,1544,1546,1548,1550,1552],{"class":448,"line":489},[446,1539,453],{"class":452},[446,1541,456],{"class":452},[446,1543,666],{"class":469},[446,1545,669],{"class":459},[446,1547,672],{"class":476},[446,1549,675],{"class":459},[446,1551,678],{"class":452},[446,1553,460],{"class":459},[446,1555,1556],{"class":448,"line":511},[446,1557,1558],{"class":521},"  // Add custom context\n",[446,1560,1561,1564,1567,1570,1573],{"class":448,"line":518},[446,1562,1563],{"class":459},"  event.context.requestId ",[446,1565,1566],{"class":452},"=",[446,1568,1569],{"class":459}," crypto.",[446,1571,1572],{"class":469},"randomUUID",[446,1574,894],{"class":459},[446,1576,1577,1580,1582,1585,1588],{"class":448,"line":525},[446,1578,1579],{"class":459},"  event.context.timestamp ",[446,1581,1566],{"class":452},[446,1583,1584],{"class":459}," Date.",[446,1586,1587],{"class":469},"now",[446,1589,894],{"class":459},[446,1591,1592],{"class":448,"line":543},[446,1593,515],{"emptyLinePlaceholder":514},[446,1595,1596],{"class":448,"line":562},[446,1597,1598],{"class":521},"  // Log the request\n",[446,1600,1601,1604,1607,1609,1612,1614,1616,1619,1621,1624,1627,1629,1631,1634,1637,1639,1641,1644,1647],{"class":448,"line":574},[446,1602,1603],{"class":459},"  console.",[446,1605,1606],{"class":469},"log",[446,1608,473],{"class":459},[446,1610,1611],{"class":537},"`[${",[446,1613,672],{"class":459},[446,1615,1068],{"class":537},[446,1617,1618],{"class":459},"context",[446,1620,1068],{"class":537},[446,1622,1623],{"class":459},"requestId",[446,1625,1626],{"class":537},"}] ${",[446,1628,672],{"class":459},[446,1630,1068],{"class":537},[446,1632,1633],{"class":459},"method",[446,1635,1636],{"class":537},"} ${",[446,1638,672],{"class":459},[446,1640,1068],{"class":537},[446,1642,1643],{"class":459},"path",[446,1645,1646],{"class":537},"}`",[446,1648,839],{"class":459},[446,1650,1651],{"class":448,"line":592},[446,1652,515],{"emptyLinePlaceholder":514},[446,1654,1655],{"class":448,"line":598},[446,1656,1657],{"class":521},"  // Continue to the next handler (don't return anything)\n",[446,1659,1660],{"class":448,"line":604},[446,1661,699],{"class":459},[1663,1664,1665],"important",{},[396,1666,1667,1668,1671],{},"If your server entry returns ",[405,1669,1670],{},"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,1673,1675],{"id":1674},"request-lifecycle","Request lifecycle",[396,1677,1678,1679,1682,1683,1685],{},"The server entry is registered as a catch-all (",[405,1680,1681],{},"/**",") route handler. When a specific route (like ",[405,1684,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,1687,1691],{"className":1688,"code":1689,"language":1690,"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,1692,1693,1704,1712,1720,1728,1733,1738],{"__ignoreMap":5},[446,1694,1695,1698,1701],{"class":448,"line":449},[446,1696,1697],{"class":476},"1.",[446,1699,1700],{"class":459}," Server hook: ",[446,1702,1703],{"class":495},"`request`\n",[446,1705,1706,1709],{"class":448,"line":463},[446,1707,1708],{"class":476},"2.",[446,1710,1711],{"class":459}," Route rules (headers, redirects, etc.)\n",[446,1713,1714,1717],{"class":448,"line":489},[446,1715,1716],{"class":476},"3.",[446,1718,1719],{"class":459}," Global middleware (middleware/)\n",[446,1721,1722,1725],{"class":448,"line":511},[446,1723,1724],{"class":476},"4.",[446,1726,1727],{"class":459}," Route matching:\n",[446,1729,1730],{"class":448,"line":518},[446,1731,1732],{"class":459},"   a. Specific routes (routes/) ← if matched, handles the request\n",[446,1734,1735],{"class":448,"line":525},[446,1736,1737],{"class":459},"   b. Server entry ← runs for unmatched routes\n",[446,1739,1740],{"class":448,"line":543},[446,1741,1742],{"class":459},"   c. Renderer (renderer.ts or index.html)\n",[396,1744,1745],{},"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,1747,1749],{"id":1748},"development-mode","Development mode",[396,1751,1752],{},"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,1754,1756],{"id":1755},"best-practices","Best practices",[717,1758,1759,1765,1771,1774,1777,1784,1787],{},[720,1760,1761,1762],{},"Use server entry for cross-cutting concerns that affect ",[1415,1763,1764],{},"all routes",[720,1766,1767,1768,1770],{},"Return ",[405,1769,1670],{}," to continue processing, return a response to terminate",[720,1772,1773],{},"Keep server entry logic lightweight for better performance",[720,1775,1776],{},"Use global middleware for modular concerns instead of one large server entry",[720,1778,1779,1780,1783],{},"Consider using ",[1039,1781,1782],{"href":49},"Nitro plugins"," for initialization logic",[720,1785,1786],{},"Avoid heavy computation in server entry (it runs for every request)",[720,1788,1789],{},"Don't use server entry for route-specific logic (use route handlers instead as they are more performant)",[1791,1792,1793],"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":1795},[1796,1798,1802,1807,1808,1809,1810],{"id":402,"depth":463,"text":1797},"Auto-detected server.ts",{"id":740,"depth":463,"text":741,"children":1799},[1800,1801],{"id":752,"depth":489,"text":753},{"id":1029,"depth":489,"text":1030},{"id":1263,"depth":463,"text":33,"children":1803},[1804,1805,1806],{"id":1266,"depth":489,"text":1267},{"id":1402,"depth":489,"text":1403},{"id":1450,"depth":489,"text":1451},{"id":1506,"depth":463,"text":1507},{"id":1674,"depth":463,"text":1675},{"id":1748,"depth":463,"text":1749},{"id":1755,"depth":463,"text":1756},"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":1811},"GdDtp7gaHNS07AyAb7r075qXuPmUG2u-CJzj6QysIVI",[1817,1819],{"title":53,"path":54,"stem":55,"description":1818,"icon":56,"children":-1},"Nitro tasks allow on-off operations in runtime.",{"title":63,"path":64,"stem":65,"description":1820,"icon":66,"children":-1},"Nitro provides a caching system built on top of the storage layer, powered by ocache.",1775152525079]