[{"data":1,"prerenderedAt":1826},["ShallowReactive",2],{"navigation":3,"-docs-server-entry":394,"-docs-server-entry-surround":1821},[4,88,217,223,379,391],{"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},"OpenAPI","/docs/openapi","1.docs/50.openapi","ri:contract-line",{"title":53,"path":54,"stem":55,"icon":56},"Plugins","/docs/plugins","1.docs/50.plugins","ri:plug-line",{"title":58,"path":59,"stem":60,"icon":61},"Tasks","/docs/tasks","1.docs/50.tasks","codicon:run-all",{"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":53,"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":375,"path":376,"stem":377,"icon":378},"WebSocket","/examples/websocket","4.examples/websocket","i-lucide-radio",{"title":380,"path":381,"stem":382,"children":383},"Blog","/blog","9.blog",[384,387],{"title":380,"path":381,"stem":385,"icon":386},"9.blog/index","i-lucide-file-text",{"title":388,"path":389,"stem":390,"icon":386},"Nitro v3 Beta is here!","/blog/v3-beta","9.blog/1.v3-beta",{"title":5,"path":392,"stem":393},"/","index",{"id":395,"title":396,"body":397,"description":1816,"extension":1695,"meta":1817,"navigation":1818,"path":64,"seo":1819,"stem":65,"__hash__":1820},"content/1.docs/6.server-entry.md","Nitro Server Entry",{"type":398,"value":399,"toc":1799,"icon":66},"minimark",[400,404,413,436,439,705,718,721,743,747,754,759,768,1032,1036,1074,1266,1269,1273,1280,1329,1340,1405,1409,1415,1439,1453,1457,1467,1509,1513,1520,1667,1677,1681,1691,1748,1751,1755,1758,1762,1795],[401,402,403],"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.",[405,406,408,409],"h2",{"id":407},"auto-detected-serverts","Auto-detected ",[410,411,412],"code",{},"server.ts",[401,414,415,416,418,419,422,423,422,426,422,429,422,432,435],{},"By default, Nitro automatically looks for a ",[410,417,412],{}," (or ",[410,420,421],{},".js",", ",[410,424,425],{},".mjs",[410,427,428],{},".mts",[410,430,431],{},".tsx",[410,433,434],{},".jsx",") file in your project root directory.",[401,437,438],{},"If found, Nitro will use it as the server entry and run it for all incoming requests.",[440,441,442,636],"code-group",{},[443,444,448],"pre",{"className":445,"code":446,"filename":412,"language":447,"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",[410,449,450,466,492,514,521,528,546,565,577,595,601,607,612,618,624,630],{"__ignoreMap":5},[451,452,455,459,462],"span",{"class":453,"line":454},"line",1,[451,456,458],{"class":457},"so5gQ","export",[451,460,461],{"class":457}," default",[451,463,465],{"class":464},"slsVL"," {\n",[451,467,469,472,476,479,483,486,489],{"class":453,"line":468},2,[451,470,471],{"class":457},"  async",[451,473,475],{"class":474},"shcOC"," fetch",[451,477,478],{"class":464},"(",[451,480,482],{"class":481},"sQHwn","req",[451,484,485],{"class":457},":",[451,487,488],{"class":474}," Request",[451,490,491],{"class":464},") {\n",[451,493,495,498,502,505,508,511],{"class":453,"line":494},3,[451,496,497],{"class":457},"    const",[451,499,501],{"class":500},"suiK_"," url",[451,503,504],{"class":457}," =",[451,506,507],{"class":457}," new",[451,509,510],{"class":474}," URL",[451,512,513],{"class":464},"(req.url);\n",[451,515,517],{"class":453,"line":516},4,[451,518,520],{"emptyLinePlaceholder":519},true,"\n",[451,522,524],{"class":453,"line":523},5,[451,525,527],{"class":526},"sCsY4","    // Handle specific routes\n",[451,529,531,534,537,540,544],{"class":453,"line":530},6,[451,532,533],{"class":457},"    if",[451,535,536],{"class":464}," (url.pathname ",[451,538,539],{"class":457},"===",[451,541,543],{"class":542},"sfrk1"," \"/health\"",[451,545,491],{"class":464},[451,547,549,552,554,557,559,562],{"class":453,"line":548},7,[451,550,551],{"class":457},"      return",[451,553,507],{"class":457},[451,555,556],{"class":474}," Response",[451,558,478],{"class":464},[451,560,561],{"class":542},"\"OK\"",[451,563,564],{"class":464},", {\n",[451,566,568,571,574],{"class":453,"line":567},8,[451,569,570],{"class":464},"        status: ",[451,572,573],{"class":500},"200",[451,575,576],{"class":464},",\n",[451,578,580,583,586,589,592],{"class":453,"line":579},9,[451,581,582],{"class":464},"        headers: { ",[451,584,585],{"class":542},"\"content-type\"",[451,587,588],{"class":464},": ",[451,590,591],{"class":542},"\"text/plain\"",[451,593,594],{"class":464}," }\n",[451,596,598],{"class":453,"line":597},10,[451,599,600],{"class":464},"      });\n",[451,602,604],{"class":453,"line":603},11,[451,605,606],{"class":464},"    }\n",[451,608,610],{"class":453,"line":609},12,[451,611,520],{"emptyLinePlaceholder":519},[451,613,615],{"class":453,"line":614},13,[451,616,617],{"class":526},"    // Add custom headers to all requests\n",[451,619,621],{"class":453,"line":620},14,[451,622,623],{"class":526},"    // Return nothing to continue to the next handler\n",[451,625,627],{"class":453,"line":626},15,[451,628,629],{"class":464},"  }\n",[451,631,633],{"class":453,"line":632},16,[451,634,635],{"class":464},"}\n",[443,637,640],{"className":445,"code":638,"filename":639,"language":447,"meta":5,"style":5},"import { defineHandler } from \"nitro\";\n\nexport default defineHandler((event) => {\n  return { hello: \"API\" };\n});\n","routes/api/hello.ts",[410,641,642,659,663,686,700],{"__ignoreMap":5},[451,643,644,647,650,653,656],{"class":453,"line":454},[451,645,646],{"class":457},"import",[451,648,649],{"class":464}," { defineHandler } ",[451,651,652],{"class":457},"from",[451,654,655],{"class":542}," \"nitro\"",[451,657,658],{"class":464},";\n",[451,660,661],{"class":453,"line":468},[451,662,520],{"emptyLinePlaceholder":519},[451,664,665,667,669,672,675,678,681,684],{"class":453,"line":494},[451,666,458],{"class":457},[451,668,461],{"class":457},[451,670,671],{"class":474}," defineHandler",[451,673,674],{"class":464},"((",[451,676,677],{"class":481},"event",[451,679,680],{"class":464},") ",[451,682,683],{"class":457},"=>",[451,685,465],{"class":464},[451,687,688,691,694,697],{"class":453,"line":516},[451,689,690],{"class":457},"  return",[451,692,693],{"class":464}," { hello: ",[451,695,696],{"class":542},"\"API\"",[451,698,699],{"class":464}," };\n",[451,701,702],{"class":453,"line":523},[451,703,704],{"class":464},"});\n",[706,707,708],"tip",{},[401,709,710,711,713,714,717],{},"When ",[410,712,412],{}," is detected, Nitro will log in the terminal: ",[410,715,716],{},"Detected \\","server.ts` as server entry.`",[401,719,720],{},"With this setup:",[722,723,724,731,737],"ul",{},[725,726,727,730],"li",{},[410,728,729],{},"/health"," → Handled by server entry (returns a response)",[725,732,733,736],{},[410,734,735],{},"/api/hello"," → Handled by the API route handler directly",[725,738,739,742],{},[410,740,741],{},"/about",", etc. → Server entry runs first, then continues to the renderer if no response is returned",[405,744,746],{"id":745},"framework-compatibility","Framework compatibility",[401,748,749,750,753],{},"The server entry is a great way to integrate with other frameworks. Any framework that exposes a standard Web ",[410,751,752],{},"fetch(request: Request): Response"," interface can be used as a server entry.",[755,756,758],"h3",{"id":757},"web-compatible-frameworks","Web-compatible frameworks",[401,760,761,762,765,766,485],{},"Frameworks that implement the Web ",[410,763,764],{},"fetch"," API work directly with ",[410,767,412],{},[769,770,771,858,950],"tabs",{},[772,773,776],"tabs-item",{"label":774,"icon":775},"H3","i-undocs-h3",[443,777,779],{"className":445,"code":778,"filename":412,"language":447,"meta":5,"style":5},"import { H3 } from \"h3\";\n\nconst app = new H3()\n\napp.get(\"/\", () => \"⚡️ Hello from H3!\");\n\nexport default app;\n",[410,780,781,795,799,817,821,845,849],{"__ignoreMap":5},[451,782,783,785,788,790,793],{"class":453,"line":454},[451,784,646],{"class":457},[451,786,787],{"class":464}," { H3 } ",[451,789,652],{"class":457},[451,791,792],{"class":542}," \"h3\"",[451,794,658],{"class":464},[451,796,797],{"class":453,"line":468},[451,798,520],{"emptyLinePlaceholder":519},[451,800,801,804,807,809,811,814],{"class":453,"line":494},[451,802,803],{"class":457},"const",[451,805,806],{"class":500}," app",[451,808,504],{"class":457},[451,810,507],{"class":457},[451,812,813],{"class":474}," H3",[451,815,816],{"class":464},"()\n",[451,818,819],{"class":453,"line":516},[451,820,520],{"emptyLinePlaceholder":519},[451,822,823,826,829,831,834,837,839,842],{"class":453,"line":523},[451,824,825],{"class":464},"app.",[451,827,828],{"class":474},"get",[451,830,478],{"class":464},[451,832,833],{"class":542},"\"/\"",[451,835,836],{"class":464},", () ",[451,838,683],{"class":457},[451,840,841],{"class":542}," \"⚡️ Hello from H3!\"",[451,843,844],{"class":464},");\n",[451,846,847],{"class":453,"line":530},[451,848,520],{"emptyLinePlaceholder":519},[451,850,851,853,855],{"class":453,"line":548},[451,852,458],{"class":457},[451,854,461],{"class":457},[451,856,857],{"class":464}," app;\n",[772,859,861],{"label":275,"icon":860},"i-undocs-hono",[443,862,864],{"className":445,"code":863,"filename":412,"language":447,"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",[410,865,866,880,884,900,904,938,942],{"__ignoreMap":5},[451,867,868,870,873,875,878],{"class":453,"line":454},[451,869,646],{"class":457},[451,871,872],{"class":464}," { Hono } ",[451,874,652],{"class":457},[451,876,877],{"class":542}," \"hono\"",[451,879,658],{"class":464},[451,881,882],{"class":453,"line":468},[451,883,520],{"emptyLinePlaceholder":519},[451,885,886,888,890,892,894,897],{"class":453,"line":494},[451,887,803],{"class":457},[451,889,806],{"class":500},[451,891,504],{"class":457},[451,893,507],{"class":457},[451,895,896],{"class":474}," Hono",[451,898,899],{"class":464},"();\n",[451,901,902],{"class":453,"line":516},[451,903,520],{"emptyLinePlaceholder":519},[451,905,906,908,910,912,914,917,920,922,924,927,930,932,935],{"class":453,"line":523},[451,907,825],{"class":464},[451,909,828],{"class":474},[451,911,478],{"class":464},[451,913,833],{"class":542},[451,915,916],{"class":464},", (",[451,918,919],{"class":481},"c",[451,921,680],{"class":464},[451,923,683],{"class":457},[451,925,926],{"class":464}," c.",[451,928,929],{"class":474},"text",[451,931,478],{"class":464},[451,933,934],{"class":542},"\"🔥 Hello from Hono!\"",[451,936,937],{"class":464},"));\n",[451,939,940],{"class":453,"line":530},[451,941,520],{"emptyLinePlaceholder":519},[451,943,944,946,948],{"class":453,"line":548},[451,945,458],{"class":457},[451,947,461],{"class":457},[451,949,857],{"class":464},[772,951,953],{"label":255,"icon":952},"i-undocs-elysia",[443,954,956],{"className":445,"code":955,"filename":412,"language":447,"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",[410,957,958,972,976,991,995,1014,1018],{"__ignoreMap":5},[451,959,960,962,965,967,970],{"class":453,"line":454},[451,961,646],{"class":457},[451,963,964],{"class":464}," { Elysia } ",[451,966,652],{"class":457},[451,968,969],{"class":542}," \"elysia\"",[451,971,658],{"class":464},[451,973,974],{"class":453,"line":468},[451,975,520],{"emptyLinePlaceholder":519},[451,977,978,980,982,984,986,989],{"class":453,"line":494},[451,979,803],{"class":457},[451,981,806],{"class":500},[451,983,504],{"class":457},[451,985,507],{"class":457},[451,987,988],{"class":474}," Elysia",[451,990,899],{"class":464},[451,992,993],{"class":453,"line":516},[451,994,520],{"emptyLinePlaceholder":519},[451,996,997,999,1001,1003,1005,1007,1009,1012],{"class":453,"line":523},[451,998,825],{"class":464},[451,1000,828],{"class":474},[451,1002,478],{"class":464},[451,1004,833],{"class":542},[451,1006,836],{"class":464},[451,1008,683],{"class":457},[451,1010,1011],{"class":542}," \"🦊 Hello from Elysia!\"",[451,1013,844],{"class":464},[451,1015,1016],{"class":453,"line":530},[451,1017,520],{"emptyLinePlaceholder":519},[451,1019,1020,1022,1024,1027,1030],{"class":453,"line":548},[451,1021,458],{"class":457},[451,1023,461],{"class":457},[451,1025,1026],{"class":464}," app.",[451,1028,1029],{"class":474},"compile",[451,1031,899],{"class":464},[755,1033,1035],{"id":1034},"nodejs-frameworks","Node.js frameworks",[401,1037,1038,1039,1042,1043,1049,1050,1054,1055,1058,1059,1061,1062,1065,1066,1073],{},"For Node.js frameworks that use ",[410,1040,1041],{},"(req, res)"," style handlers (like ",[1044,1045,260],"a",{"href":1046,"rel":1047},"https://expressjs.com/",[1048],"nofollow"," or ",[1044,1051,265],{"href":1052,"rel":1053},"https://fastify.dev/",[1048],"), name your server entry file ",[410,1056,1057],{},"server.node.ts"," instead of ",[410,1060,412],{},". Nitro will automatically detect the ",[410,1063,1064],{},".node."," suffix and convert the Node.js handler to a web-compatible fetch handler using ",[1044,1067,1070],{"href":1068,"rel":1069},"https://srvx.h3.dev/",[1048],[410,1071,1072],{},"srvx",".",[769,1075,1076,1176],{},[772,1077,1078],{"label":260},[443,1079,1081],{"className":445,"code":1080,"filename":1057,"language":447,"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",[410,1082,1083,1097,1101,1114,1118,1145,1160,1164,1168],{"__ignoreMap":5},[451,1084,1085,1087,1090,1092,1095],{"class":453,"line":454},[451,1086,646],{"class":457},[451,1088,1089],{"class":464}," Express ",[451,1091,652],{"class":457},[451,1093,1094],{"class":542}," \"express\"",[451,1096,658],{"class":464},[451,1098,1099],{"class":453,"line":468},[451,1100,520],{"emptyLinePlaceholder":519},[451,1102,1103,1105,1107,1109,1112],{"class":453,"line":494},[451,1104,803],{"class":457},[451,1106,806],{"class":500},[451,1108,504],{"class":457},[451,1110,1111],{"class":474}," Express",[451,1113,899],{"class":464},[451,1115,1116],{"class":453,"line":516},[451,1117,520],{"emptyLinePlaceholder":519},[451,1119,1120,1122,1125,1127,1129,1131,1134,1136,1139,1141,1143],{"class":453,"line":523},[451,1121,825],{"class":464},[451,1123,1124],{"class":474},"use",[451,1126,478],{"class":464},[451,1128,833],{"class":542},[451,1130,916],{"class":464},[451,1132,1133],{"class":481},"_req",[451,1135,422],{"class":464},[451,1137,1138],{"class":481},"res",[451,1140,680],{"class":464},[451,1142,683],{"class":457},[451,1144,465],{"class":464},[451,1146,1147,1150,1153,1155,1158],{"class":453,"line":530},[451,1148,1149],{"class":464},"  res.",[451,1151,1152],{"class":474},"send",[451,1154,478],{"class":464},[451,1156,1157],{"class":542},"\"Hello from Express with Nitro!\"",[451,1159,844],{"class":464},[451,1161,1162],{"class":453,"line":548},[451,1163,704],{"class":464},[451,1165,1166],{"class":453,"line":567},[451,1167,520],{"emptyLinePlaceholder":519},[451,1169,1170,1172,1174],{"class":453,"line":579},[451,1171,458],{"class":457},[451,1173,461],{"class":457},[451,1175,857],{"class":464},[772,1177,1178],{"label":265},[443,1179,1181],{"className":445,"code":1180,"filename":1057,"language":447,"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",[410,1182,1183,1197,1201,1214,1218,1237,1241,1253,1257],{"__ignoreMap":5},[451,1184,1185,1187,1190,1192,1195],{"class":453,"line":454},[451,1186,646],{"class":457},[451,1188,1189],{"class":464}," Fastify ",[451,1191,652],{"class":457},[451,1193,1194],{"class":542}," \"fastify\"",[451,1196,658],{"class":464},[451,1198,1199],{"class":453,"line":468},[451,1200,520],{"emptyLinePlaceholder":519},[451,1202,1203,1205,1207,1209,1212],{"class":453,"line":494},[451,1204,803],{"class":457},[451,1206,806],{"class":500},[451,1208,504],{"class":457},[451,1210,1211],{"class":474}," Fastify",[451,1213,899],{"class":464},[451,1215,1216],{"class":453,"line":516},[451,1217,520],{"emptyLinePlaceholder":519},[451,1219,1220,1222,1224,1226,1228,1230,1232,1235],{"class":453,"line":523},[451,1221,825],{"class":464},[451,1223,828],{"class":474},[451,1225,478],{"class":464},[451,1227,833],{"class":542},[451,1229,836],{"class":464},[451,1231,683],{"class":457},[451,1233,1234],{"class":542}," \"Hello, Fastify with Nitro!\"",[451,1236,844],{"class":464},[451,1238,1239],{"class":453,"line":530},[451,1240,520],{"emptyLinePlaceholder":519},[451,1242,1243,1246,1248,1251],{"class":453,"line":548},[451,1244,1245],{"class":457},"await",[451,1247,1026],{"class":464},[451,1249,1250],{"class":474},"ready",[451,1252,899],{"class":464},[451,1254,1255],{"class":453,"line":567},[451,1256,520],{"emptyLinePlaceholder":519},[451,1258,1259,1261,1263],{"class":453,"line":579},[451,1260,458],{"class":457},[451,1262,461],{"class":457},[451,1264,1265],{"class":464}," app.routing;\n",[405,1267,33],{"id":1268},"configuration",[755,1270,1272],{"id":1271},"custom-server-entry-file","Custom server entry file",[401,1274,1275,1276,1279],{},"You can specify a custom server entry file using the ",[410,1277,1278],{},"serverEntry"," option in your Nitro configuration:",[443,1281,1284],{"className":445,"code":1282,"filename":1283,"language":447,"meta":5,"style":5},"import { defineNitroConfig } from \"nitro/config\";\n\nexport default defineNitroConfig({\n  serverEntry: \"./nitro.server.ts\"\n})\n","nitro.config.ts",[410,1285,1286,1300,1304,1316,1324],{"__ignoreMap":5},[451,1287,1288,1290,1293,1295,1298],{"class":453,"line":454},[451,1289,646],{"class":457},[451,1291,1292],{"class":464}," { defineNitroConfig } ",[451,1294,652],{"class":457},[451,1296,1297],{"class":542}," \"nitro/config\"",[451,1299,658],{"class":464},[451,1301,1302],{"class":453,"line":468},[451,1303,520],{"emptyLinePlaceholder":519},[451,1305,1306,1308,1310,1313],{"class":453,"line":494},[451,1307,458],{"class":457},[451,1309,461],{"class":457},[451,1311,1312],{"class":474}," defineNitroConfig",[451,1314,1315],{"class":464},"({\n",[451,1317,1318,1321],{"class":453,"line":516},[451,1319,1320],{"class":464},"  serverEntry: ",[451,1322,1323],{"class":542},"\"./nitro.server.ts\"\n",[451,1325,1326],{"class":453,"line":523},[451,1327,1328],{"class":464},"})\n",[401,1330,1331,1332,1335,1336,1339],{},"You can also provide an object with ",[410,1333,1334],{},"handler"," and ",[410,1337,1338],{},"format"," options:",[443,1341,1343],{"className":445,"code":1342,"filename":1283,"language":447,"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",[410,1344,1345,1357,1361,1371,1376,1386,1397,1401],{"__ignoreMap":5},[451,1346,1347,1349,1351,1353,1355],{"class":453,"line":454},[451,1348,646],{"class":457},[451,1350,1292],{"class":464},[451,1352,652],{"class":457},[451,1354,1297],{"class":542},[451,1356,658],{"class":464},[451,1358,1359],{"class":453,"line":468},[451,1360,520],{"emptyLinePlaceholder":519},[451,1362,1363,1365,1367,1369],{"class":453,"line":494},[451,1364,458],{"class":457},[451,1366,461],{"class":457},[451,1368,1312],{"class":474},[451,1370,1315],{"class":464},[451,1372,1373],{"class":453,"line":516},[451,1374,1375],{"class":464},"  serverEntry: {\n",[451,1377,1378,1381,1384],{"class":453,"line":523},[451,1379,1380],{"class":464},"    handler: ",[451,1382,1383],{"class":542},"\"./server.ts\"",[451,1385,576],{"class":464},[451,1387,1388,1391,1394],{"class":453,"line":530},[451,1389,1390],{"class":464},"    format: ",[451,1392,1393],{"class":542},"\"node\"",[451,1395,1396],{"class":526}," // \"web\" (default) or \"node\"\n",[451,1398,1399],{"class":453,"line":548},[451,1400,629],{"class":464},[451,1402,1403],{"class":453,"line":567},[451,1404,1328],{"class":464},[755,1406,1408],{"id":1407},"handler-format","Handler format",[401,1410,1411,1412,1414],{},"The ",[410,1413,1338],{}," option controls how Nitro treats the default export of your server entry:",[722,1416,1417,1429],{},[725,1418,1419,1425,1426,1428],{},[1420,1421,1422],"strong",{},[410,1423,1424],{},"\"web\""," (default) — Expects a Web-compatible handler with a ",[410,1427,752],{}," method.",[725,1430,1431,1435,1436,1438],{},[1420,1432,1433],{},[410,1434,1393],{}," — Expects a Node.js-style ",[410,1437,1041],{}," handler. Nitro automatically converts it to a web-compatible handler.",[401,1440,1441,1442,1444,1445,1447,1448,1444,1450,1452],{},"When auto-detecting, the format is determined by the filename: ",[410,1443,1057],{}," uses ",[410,1446,1393],{}," format, while ",[410,1449,412],{},[410,1451,1424],{}," format.",[755,1454,1456],{"id":1455},"disabling-server-entry","Disabling server entry",[401,1458,1459,1460,1462,1463,1466],{},"Set ",[410,1461,1278],{}," to ",[410,1464,1465],{},"false"," to disable auto-detection and prevent Nitro from using any server entry:",[443,1468,1470],{"className":445,"code":1469,"filename":1283,"language":447,"meta":5,"style":5},"import { defineNitroConfig } from \"nitro/config\";\n\nexport default defineNitroConfig({\n  serverEntry: false\n})\n",[410,1471,1472,1484,1488,1498,1505],{"__ignoreMap":5},[451,1473,1474,1476,1478,1480,1482],{"class":453,"line":454},[451,1475,646],{"class":457},[451,1477,1292],{"class":464},[451,1479,652],{"class":457},[451,1481,1297],{"class":542},[451,1483,658],{"class":464},[451,1485,1486],{"class":453,"line":468},[451,1487,520],{"emptyLinePlaceholder":519},[451,1489,1490,1492,1494,1496],{"class":453,"line":494},[451,1491,458],{"class":457},[451,1493,461],{"class":457},[451,1495,1312],{"class":474},[451,1497,1315],{"class":464},[451,1499,1500,1502],{"class":453,"line":516},[451,1501,1320],{"class":464},[451,1503,1504],{"class":500},"false\n",[451,1506,1507],{"class":453,"line":523},[451,1508,1328],{"class":464},[405,1510,1512],{"id":1511},"using-event-handler","Using event handler",[401,1514,1515,1516,1519],{},"You can also export an event handler using ",[410,1517,1518],{},"defineHandler"," for better type inference and access to the h3 event object:",[443,1521,1523],{"className":445,"code":1522,"filename":412,"language":447,"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",[410,1524,1525,1537,1541,1559,1564,1580,1595,1599,1604,1654,1658,1663],{"__ignoreMap":5},[451,1526,1527,1529,1531,1533,1535],{"class":453,"line":454},[451,1528,646],{"class":457},[451,1530,649],{"class":464},[451,1532,652],{"class":457},[451,1534,655],{"class":542},[451,1536,658],{"class":464},[451,1538,1539],{"class":453,"line":468},[451,1540,520],{"emptyLinePlaceholder":519},[451,1542,1543,1545,1547,1549,1551,1553,1555,1557],{"class":453,"line":494},[451,1544,458],{"class":457},[451,1546,461],{"class":457},[451,1548,671],{"class":474},[451,1550,674],{"class":464},[451,1552,677],{"class":481},[451,1554,680],{"class":464},[451,1556,683],{"class":457},[451,1558,465],{"class":464},[451,1560,1561],{"class":453,"line":516},[451,1562,1563],{"class":526},"  // Add custom context\n",[451,1565,1566,1569,1572,1575,1578],{"class":453,"line":523},[451,1567,1568],{"class":464},"  event.context.requestId ",[451,1570,1571],{"class":457},"=",[451,1573,1574],{"class":464}," crypto.",[451,1576,1577],{"class":474},"randomUUID",[451,1579,899],{"class":464},[451,1581,1582,1585,1587,1590,1593],{"class":453,"line":530},[451,1583,1584],{"class":464},"  event.context.timestamp ",[451,1586,1571],{"class":457},[451,1588,1589],{"class":464}," Date.",[451,1591,1592],{"class":474},"now",[451,1594,899],{"class":464},[451,1596,1597],{"class":453,"line":548},[451,1598,520],{"emptyLinePlaceholder":519},[451,1600,1601],{"class":453,"line":567},[451,1602,1603],{"class":526},"  // Log the request\n",[451,1605,1606,1609,1612,1614,1617,1619,1621,1624,1626,1629,1632,1634,1636,1639,1642,1644,1646,1649,1652],{"class":453,"line":579},[451,1607,1608],{"class":464},"  console.",[451,1610,1611],{"class":474},"log",[451,1613,478],{"class":464},[451,1615,1616],{"class":542},"`[${",[451,1618,677],{"class":464},[451,1620,1073],{"class":542},[451,1622,1623],{"class":464},"context",[451,1625,1073],{"class":542},[451,1627,1628],{"class":464},"requestId",[451,1630,1631],{"class":542},"}] ${",[451,1633,677],{"class":464},[451,1635,1073],{"class":542},[451,1637,1638],{"class":464},"method",[451,1640,1641],{"class":542},"} ${",[451,1643,677],{"class":464},[451,1645,1073],{"class":542},[451,1647,1648],{"class":464},"path",[451,1650,1651],{"class":542},"}`",[451,1653,844],{"class":464},[451,1655,1656],{"class":453,"line":597},[451,1657,520],{"emptyLinePlaceholder":519},[451,1659,1660],{"class":453,"line":603},[451,1661,1662],{"class":526},"  // Continue to the next handler (don't return anything)\n",[451,1664,1665],{"class":453,"line":609},[451,1666,704],{"class":464},[1668,1669,1670],"important",{},[401,1671,1672,1673,1676],{},"If your server entry returns ",[410,1674,1675],{},"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.",[405,1678,1680],{"id":1679},"request-lifecycle","Request lifecycle",[401,1682,1683,1684,1687,1688,1690],{},"The server entry is registered as a catch-all (",[410,1685,1686],{},"/**",") route handler. When a specific route (like ",[410,1689,735],{},") matches a request, that route handler takes priority. For requests that don't match any specific route, the server entry runs before the renderer:",[443,1692,1696],{"className":1693,"code":1694,"language":1695,"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",[410,1697,1698,1709,1717,1725,1733,1738,1743],{"__ignoreMap":5},[451,1699,1700,1703,1706],{"class":453,"line":454},[451,1701,1702],{"class":481},"1.",[451,1704,1705],{"class":464}," Server hook: ",[451,1707,1708],{"class":500},"`request`\n",[451,1710,1711,1714],{"class":453,"line":468},[451,1712,1713],{"class":481},"2.",[451,1715,1716],{"class":464}," Route rules (headers, redirects, etc.)\n",[451,1718,1719,1722],{"class":453,"line":494},[451,1720,1721],{"class":481},"3.",[451,1723,1724],{"class":464}," Global middleware (middleware/)\n",[451,1726,1727,1730],{"class":453,"line":516},[451,1728,1729],{"class":481},"4.",[451,1731,1732],{"class":464}," Route matching:\n",[451,1734,1735],{"class":453,"line":523},[451,1736,1737],{"class":464},"   a. Specific routes (routes/) ← if matched, handles the request\n",[451,1739,1740],{"class":453,"line":530},[451,1741,1742],{"class":464},"   b. Server entry ← runs for unmatched routes\n",[451,1744,1745],{"class":453,"line":548},[451,1746,1747],{"class":464},"   c. Renderer (renderer.ts or index.html)\n",[401,1749,1750],{},"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.",[405,1752,1754],{"id":1753},"development-mode","Development mode",[401,1756,1757],{},"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.",[405,1759,1761],{"id":1760},"best-practices","Best practices",[722,1763,1764,1770,1776,1779,1782,1789,1792],{},[725,1765,1766,1767],{},"Use server entry for cross-cutting concerns that affect ",[1420,1768,1769],{},"all routes",[725,1771,1772,1773,1775],{},"Return ",[410,1774,1675],{}," to continue processing, return a response to terminate",[725,1777,1778],{},"Keep server entry logic lightweight for better performance",[725,1780,1781],{},"Use global middleware for modular concerns instead of one large server entry",[725,1783,1784,1785,1788],{},"Consider using ",[1044,1786,1787],{"href":54},"Nitro plugins"," for initialization logic",[725,1790,1791],{},"Avoid heavy computation in server entry (it runs for every request)",[725,1793,1794],{},"Don't use server entry for route-specific logic (use route handlers instead as they are more performant)",[1796,1797,1798],"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":468,"depth":468,"links":1800},[1801,1803,1807,1812,1813,1814,1815],{"id":407,"depth":468,"text":1802},"Auto-detected server.ts",{"id":745,"depth":468,"text":746,"children":1804},[1805,1806],{"id":757,"depth":494,"text":758},{"id":1034,"depth":494,"text":1035},{"id":1268,"depth":468,"text":33,"children":1808},[1809,1810,1811],{"id":1271,"depth":494,"text":1272},{"id":1407,"depth":494,"text":1408},{"id":1455,"depth":494,"text":1456},{"id":1511,"depth":468,"text":1512},{"id":1679,"depth":468,"text":1680},{"id":1753,"depth":468,"text":1754},{"id":1760,"depth":468,"text":1761},"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":396,"description":1816},"GdDtp7gaHNS07AyAb7r075qXuPmUG2u-CJzj6QysIVI",[1822,1824],{"title":58,"path":59,"stem":60,"description":1823,"icon":61,"children":-1},"Nitro tasks allow on-off operations in runtime.",{"title":68,"path":69,"stem":70,"description":1825,"icon":71,"children":-1},"Nitro provides a caching system built on top of the storage layer, powered by ocache.",1775834858587]