[{"data":1,"prerenderedAt":1825},["ShallowReactive",2],{"navigation":3,"-docs-server-entry":394,"-docs-server-entry-surround":1820},[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":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":398,"value":399,"toc":1798,"icon":66},"minimark",[400,404,413,436,439,705,718,721,743,747,754,759,768,1032,1036,1074,1266,1269,1273,1280,1328,1339,1404,1408,1414,1438,1452,1456,1466,1508,1512,1519,1666,1676,1680,1690,1747,1750,1754,1757,1761,1794],[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 { defineConfig } from \"nitro\";\n\nexport default defineConfig({\n  serverEntry: \"./nitro.server.ts\"\n})\n","nitro.config.ts",[410,1285,1286,1299,1303,1315,1323],{"__ignoreMap":5},[451,1287,1288,1290,1293,1295,1297],{"class":453,"line":454},[451,1289,646],{"class":457},[451,1291,1292],{"class":464}," { defineConfig } ",[451,1294,652],{"class":457},[451,1296,655],{"class":542},[451,1298,658],{"class":464},[451,1300,1301],{"class":453,"line":468},[451,1302,520],{"emptyLinePlaceholder":519},[451,1304,1305,1307,1309,1312],{"class":453,"line":494},[451,1306,458],{"class":457},[451,1308,461],{"class":457},[451,1310,1311],{"class":474}," defineConfig",[451,1313,1314],{"class":464},"({\n",[451,1316,1317,1320],{"class":453,"line":516},[451,1318,1319],{"class":464},"  serverEntry: ",[451,1321,1322],{"class":542},"\"./nitro.server.ts\"\n",[451,1324,1325],{"class":453,"line":523},[451,1326,1327],{"class":464},"})\n",[401,1329,1330,1331,1334,1335,1338],{},"You can also provide an object with ",[410,1332,1333],{},"handler"," and ",[410,1336,1337],{},"format"," options:",[443,1340,1342],{"className":445,"code":1341,"filename":1283,"language":447,"meta":5,"style":5},"import { defineConfig } from \"nitro\";\n\nexport default defineConfig({\n  serverEntry: {\n    handler: \"./server.ts\",\n    format: \"node\" // \"web\" (default) or \"node\"\n  }\n})\n",[410,1343,1344,1356,1360,1370,1375,1385,1396,1400],{"__ignoreMap":5},[451,1345,1346,1348,1350,1352,1354],{"class":453,"line":454},[451,1347,646],{"class":457},[451,1349,1292],{"class":464},[451,1351,652],{"class":457},[451,1353,655],{"class":542},[451,1355,658],{"class":464},[451,1357,1358],{"class":453,"line":468},[451,1359,520],{"emptyLinePlaceholder":519},[451,1361,1362,1364,1366,1368],{"class":453,"line":494},[451,1363,458],{"class":457},[451,1365,461],{"class":457},[451,1367,1311],{"class":474},[451,1369,1314],{"class":464},[451,1371,1372],{"class":453,"line":516},[451,1373,1374],{"class":464},"  serverEntry: {\n",[451,1376,1377,1380,1383],{"class":453,"line":523},[451,1378,1379],{"class":464},"    handler: ",[451,1381,1382],{"class":542},"\"./server.ts\"",[451,1384,576],{"class":464},[451,1386,1387,1390,1393],{"class":453,"line":530},[451,1388,1389],{"class":464},"    format: ",[451,1391,1392],{"class":542},"\"node\"",[451,1394,1395],{"class":526}," // \"web\" (default) or \"node\"\n",[451,1397,1398],{"class":453,"line":548},[451,1399,629],{"class":464},[451,1401,1402],{"class":453,"line":567},[451,1403,1327],{"class":464},[755,1405,1407],{"id":1406},"handler-format","Handler format",[401,1409,1410,1411,1413],{},"The ",[410,1412,1337],{}," option controls how Nitro treats the default export of your server entry:",[722,1415,1416,1428],{},[725,1417,1418,1424,1425,1427],{},[1419,1420,1421],"strong",{},[410,1422,1423],{},"\"web\""," (default) — Expects a Web-compatible handler with a ",[410,1426,752],{}," method.",[725,1429,1430,1434,1435,1437],{},[1419,1431,1432],{},[410,1433,1392],{}," — Expects a Node.js-style ",[410,1436,1041],{}," handler. Nitro automatically converts it to a web-compatible handler.",[401,1439,1440,1441,1443,1444,1446,1447,1443,1449,1451],{},"When auto-detecting, the format is determined by the filename: ",[410,1442,1057],{}," uses ",[410,1445,1392],{}," format, while ",[410,1448,412],{},[410,1450,1423],{}," format.",[755,1453,1455],{"id":1454},"disabling-server-entry","Disabling server entry",[401,1457,1458,1459,1461,1462,1465],{},"Set ",[410,1460,1278],{}," to ",[410,1463,1464],{},"false"," to disable auto-detection and prevent Nitro from using any server entry:",[443,1467,1469],{"className":445,"code":1468,"filename":1283,"language":447,"meta":5,"style":5},"import { defineConfig } from \"nitro\";\n\nexport default defineConfig({\n  serverEntry: false\n})\n",[410,1470,1471,1483,1487,1497,1504],{"__ignoreMap":5},[451,1472,1473,1475,1477,1479,1481],{"class":453,"line":454},[451,1474,646],{"class":457},[451,1476,1292],{"class":464},[451,1478,652],{"class":457},[451,1480,655],{"class":542},[451,1482,658],{"class":464},[451,1484,1485],{"class":453,"line":468},[451,1486,520],{"emptyLinePlaceholder":519},[451,1488,1489,1491,1493,1495],{"class":453,"line":494},[451,1490,458],{"class":457},[451,1492,461],{"class":457},[451,1494,1311],{"class":474},[451,1496,1314],{"class":464},[451,1498,1499,1501],{"class":453,"line":516},[451,1500,1319],{"class":464},[451,1502,1503],{"class":500},"false\n",[451,1505,1506],{"class":453,"line":523},[451,1507,1327],{"class":464},[405,1509,1511],{"id":1510},"using-event-handler","Using event handler",[401,1513,1514,1515,1518],{},"You can also export an event handler using ",[410,1516,1517],{},"defineHandler"," for better type inference and access to the h3 event object:",[443,1520,1522],{"className":445,"code":1521,"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,1523,1524,1536,1540,1558,1563,1579,1594,1598,1603,1653,1657,1662],{"__ignoreMap":5},[451,1525,1526,1528,1530,1532,1534],{"class":453,"line":454},[451,1527,646],{"class":457},[451,1529,649],{"class":464},[451,1531,652],{"class":457},[451,1533,655],{"class":542},[451,1535,658],{"class":464},[451,1537,1538],{"class":453,"line":468},[451,1539,520],{"emptyLinePlaceholder":519},[451,1541,1542,1544,1546,1548,1550,1552,1554,1556],{"class":453,"line":494},[451,1543,458],{"class":457},[451,1545,461],{"class":457},[451,1547,671],{"class":474},[451,1549,674],{"class":464},[451,1551,677],{"class":481},[451,1553,680],{"class":464},[451,1555,683],{"class":457},[451,1557,465],{"class":464},[451,1559,1560],{"class":453,"line":516},[451,1561,1562],{"class":526},"  // Add custom context\n",[451,1564,1565,1568,1571,1574,1577],{"class":453,"line":523},[451,1566,1567],{"class":464},"  event.context.requestId ",[451,1569,1570],{"class":457},"=",[451,1572,1573],{"class":464}," crypto.",[451,1575,1576],{"class":474},"randomUUID",[451,1578,899],{"class":464},[451,1580,1581,1584,1586,1589,1592],{"class":453,"line":530},[451,1582,1583],{"class":464},"  event.context.timestamp ",[451,1585,1570],{"class":457},[451,1587,1588],{"class":464}," Date.",[451,1590,1591],{"class":474},"now",[451,1593,899],{"class":464},[451,1595,1596],{"class":453,"line":548},[451,1597,520],{"emptyLinePlaceholder":519},[451,1599,1600],{"class":453,"line":567},[451,1601,1602],{"class":526},"  // Log the request\n",[451,1604,1605,1608,1611,1613,1616,1618,1620,1623,1625,1628,1631,1633,1635,1638,1641,1643,1645,1648,1651],{"class":453,"line":579},[451,1606,1607],{"class":464},"  console.",[451,1609,1610],{"class":474},"log",[451,1612,478],{"class":464},[451,1614,1615],{"class":542},"`[${",[451,1617,677],{"class":464},[451,1619,1073],{"class":542},[451,1621,1622],{"class":464},"context",[451,1624,1073],{"class":542},[451,1626,1627],{"class":464},"requestId",[451,1629,1630],{"class":542},"}] ${",[451,1632,677],{"class":464},[451,1634,1073],{"class":542},[451,1636,1637],{"class":464},"method",[451,1639,1640],{"class":542},"} ${",[451,1642,677],{"class":464},[451,1644,1073],{"class":542},[451,1646,1647],{"class":464},"path",[451,1649,1650],{"class":542},"}`",[451,1652,844],{"class":464},[451,1654,1655],{"class":453,"line":597},[451,1656,520],{"emptyLinePlaceholder":519},[451,1658,1659],{"class":453,"line":603},[451,1660,1661],{"class":526},"  // Continue to the next handler (don't return anything)\n",[451,1663,1664],{"class":453,"line":609},[451,1665,704],{"class":464},[1667,1668,1669],"important",{},[401,1670,1671,1672,1675],{},"If your server entry returns ",[410,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.",[405,1677,1679],{"id":1678},"request-lifecycle","Request lifecycle",[401,1681,1682,1683,1686,1687,1689],{},"The server entry is registered as a catch-all (",[410,1684,1685],{},"/**",") route handler. When a specific route (like ",[410,1688,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,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",[410,1696,1697,1708,1716,1724,1732,1737,1742],{"__ignoreMap":5},[451,1698,1699,1702,1705],{"class":453,"line":454},[451,1700,1701],{"class":481},"1.",[451,1703,1704],{"class":464}," Server hook: ",[451,1706,1707],{"class":500},"`request`\n",[451,1709,1710,1713],{"class":453,"line":468},[451,1711,1712],{"class":481},"2.",[451,1714,1715],{"class":464}," Route rules (headers, redirects, etc.)\n",[451,1717,1718,1721],{"class":453,"line":494},[451,1719,1720],{"class":481},"3.",[451,1722,1723],{"class":464}," Global middleware (middleware/)\n",[451,1725,1726,1729],{"class":453,"line":516},[451,1727,1728],{"class":481},"4.",[451,1730,1731],{"class":464}," Route matching:\n",[451,1733,1734],{"class":453,"line":523},[451,1735,1736],{"class":464},"   a. Specific routes (routes/) ← if matched, handles the request\n",[451,1738,1739],{"class":453,"line":530},[451,1740,1741],{"class":464},"   b. Server entry ← runs for unmatched routes\n",[451,1743,1744],{"class":453,"line":548},[451,1745,1746],{"class":464},"   c. Renderer (renderer.ts or index.html)\n",[401,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.",[405,1751,1753],{"id":1752},"development-mode","Development mode",[401,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.",[405,1758,1760],{"id":1759},"best-practices","Best practices",[722,1762,1763,1769,1775,1778,1781,1788,1791],{},[725,1764,1765,1766],{},"Use server entry for cross-cutting concerns that affect ",[1419,1767,1768],{},"all routes",[725,1770,1771,1772,1774],{},"Return ",[410,1773,1674],{}," to continue processing, return a response to terminate",[725,1776,1777],{},"Keep server entry logic lightweight for better performance",[725,1779,1780],{},"Use global middleware for modular concerns instead of one large server entry",[725,1782,1783,1784,1787],{},"Consider using ",[1044,1785,1786],{"href":54},"Nitro plugins"," for initialization logic",[725,1789,1790],{},"Avoid heavy computation in server entry (it runs for every request)",[725,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":468,"depth":468,"links":1799},[1800,1802,1806,1811,1812,1813,1814],{"id":407,"depth":468,"text":1801},"Auto-detected server.ts",{"id":745,"depth":468,"text":746,"children":1803},[1804,1805],{"id":757,"depth":494,"text":758},{"id":1034,"depth":494,"text":1035},{"id":1268,"depth":468,"text":33,"children":1807},[1808,1809,1810],{"id":1271,"depth":494,"text":1272},{"id":1406,"depth":494,"text":1407},{"id":1454,"depth":494,"text":1455},{"id":1510,"depth":468,"text":1511},{"id":1678,"depth":468,"text":1679},{"id":1752,"depth":468,"text":1753},{"id":1759,"depth":468,"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":396,"description":1815},"2vT-x67m5i87V63-fSajv7cQHGKTu7waSNduJPTpMVQ",[1821,1823],{"title":58,"path":59,"stem":60,"description":1822,"icon":61,"children":-1},"Nitro tasks allow on-off operations in runtime.",{"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.",1776075610849]