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