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