[{"data":1,"prerenderedAt":1228},["ShallowReactive",2],{"navigation":3,"-docs-server-entry":224,"-docs-server-entry-surround":1223},[4,83,208,214,221],{"title":5,"path":6,"stem":7,"children":8,"icon":82},"","/docs","1.docs/1.index",[9,12,17,22,27,32,37,42,47,52,57,62,67,72,77],{"title":10,"path":6,"stem":7,"icon":11},"Introduction","i-lucide-compass",{"title":13,"path":14,"stem":15,"icon":16},"Quick Start","/docs/quick-start","1.docs/2.quick-start","i-lucide-zap",{"title":18,"path":19,"stem":20,"icon":21},"Renderer","/docs/renderer","1.docs/4.renderer","ri:layout-masonry-line",{"title":23,"path":24,"stem":25,"icon":26},"Routing","/docs/routing","1.docs/5.routing","ri:direction-line",{"title":28,"path":29,"stem":30,"icon":31},"Assets","/docs/assets","1.docs/50.assets","ri:image-2-line",{"title":33,"path":34,"stem":35,"icon":36},"Configuration","/docs/configuration","1.docs/50.configuration","ri:settings-3-line",{"title":38,"path":39,"stem":40,"icon":41},"Database","/docs/database","1.docs/50.database","ri:database-2-line",{"title":43,"path":44,"stem":45,"icon":46},"Lifecycle","/docs/lifecycle","1.docs/50.lifecycle","i-lucide-layers",{"title":48,"path":49,"stem":50,"icon":51},"Plugins","/docs/plugins","1.docs/50.plugins","ri:plug-line",{"title":53,"path":54,"stem":55,"icon":56},"Tasks","/docs/tasks","1.docs/50.tasks","codicon:run-all",{"title":58,"path":59,"stem":60,"icon":61},"Server Entry","/docs/server-entry","1.docs/6.server-entry","ri:server-line",{"title":63,"path":64,"stem":65,"icon":66},"Cache","/docs/cache","1.docs/7.cache","ri:speed-line",{"title":68,"path":69,"stem":70,"icon":71},"KV Storage","/docs/storage","1.docs/8.storage","carbon:datastore",{"title":73,"path":74,"stem":75,"icon":76},"Migration Guide","/docs/migration","1.docs/99.migration","ri:arrow-right-up-line",{"title":78,"path":79,"stem":80,"icon":81},"Nightly Channel","/docs/nightly","1.docs/99.nightly","ri:moon-fill","i-lucide-book-open",{"title":84,"path":85,"stem":86,"children":87,"icon":89},"Deploy","/deploy","2.deploy/0.index",[88,90,111],{"title":84,"path":85,"stem":86,"icon":89},"ri:upload-cloud-2-line",{"title":91,"path":92,"stem":93,"children":94,"page":110},"Runtimes","/deploy/runtimes","2.deploy/10.runtimes",[95,100,105],{"title":96,"path":97,"stem":98,"icon":99},"Node.js","/deploy/runtimes/node","2.deploy/10.runtimes/1.node","akar-icons:node-fill",{"title":101,"path":102,"stem":103,"icon":104},"Bun","/deploy/runtimes/bun","2.deploy/10.runtimes/bun","simple-icons:bun",{"title":106,"path":107,"stem":108,"icon":109},"Deno","/deploy/runtimes/deno","2.deploy/10.runtimes/deno","simple-icons:deno",false,{"title":112,"path":113,"stem":114,"children":115,"page":110},"Providers","/deploy/providers","2.deploy/20.providers",[116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204],{"title":117,"path":118,"stem":119},"Alwaysdata","/deploy/providers/alwaysdata","2.deploy/20.providers/alwaysdata",{"title":121,"path":122,"stem":123},"AWS Lambda","/deploy/providers/aws","2.deploy/20.providers/aws",{"title":125,"path":126,"stem":127},"AWS Amplify","/deploy/providers/aws-amplify","2.deploy/20.providers/aws-amplify",{"title":129,"path":130,"stem":131},"Azure","/deploy/providers/azure","2.deploy/20.providers/azure",{"title":133,"path":134,"stem":135},"Cleavr","/deploy/providers/cleavr","2.deploy/20.providers/cleavr",{"title":137,"path":138,"stem":139},"Cloudflare","/deploy/providers/cloudflare","2.deploy/20.providers/cloudflare",{"title":141,"path":142,"stem":143},"Deno Deploy","/deploy/providers/deno-deploy","2.deploy/20.providers/deno-deploy",{"title":145,"path":146,"stem":147},"DigitalOcean","/deploy/providers/digitalocean","2.deploy/20.providers/digitalocean",{"title":149,"path":150,"stem":151},"Firebase","/deploy/providers/firebase","2.deploy/20.providers/firebase",{"title":153,"path":154,"stem":155},"Flightcontrol","/deploy/providers/flightcontrol","2.deploy/20.providers/flightcontrol",{"title":157,"path":158,"stem":159},"Genezio","/deploy/providers/genezio","2.deploy/20.providers/genezio",{"title":161,"path":162,"stem":163},"GitHub Pages","/deploy/providers/github-pages","2.deploy/20.providers/github-pages",{"title":165,"path":166,"stem":167},"GitLab Pages","/deploy/providers/gitlab-pages","2.deploy/20.providers/gitlab-pages",{"title":169,"path":170,"stem":171},"Heroku","/deploy/providers/heroku","2.deploy/20.providers/heroku",{"title":173,"path":174,"stem":175},"IIS","/deploy/providers/iis","2.deploy/20.providers/iis",{"title":177,"path":178,"stem":179},"Koyeb","/deploy/providers/koyeb","2.deploy/20.providers/koyeb",{"title":181,"path":182,"stem":183},"Netlify","/deploy/providers/netlify","2.deploy/20.providers/netlify",{"title":185,"path":186,"stem":187},"Platform.sh","/deploy/providers/platform-sh","2.deploy/20.providers/platform-sh",{"title":189,"path":190,"stem":191},"Render.com","/deploy/providers/render","2.deploy/20.providers/render",{"title":193,"path":194,"stem":195},"StormKit","/deploy/providers/stormkit","2.deploy/20.providers/stormkit",{"title":197,"path":198,"stem":199},"Vercel","/deploy/providers/vercel","2.deploy/20.providers/vercel",{"title":201,"path":202,"stem":203},"Zeabur","/deploy/providers/zeabur","2.deploy/20.providers/zeabur",{"title":205,"path":206,"stem":207},"Zerops","/deploy/providers/zerops","2.deploy/20.providers/zerops",{"title":209,"path":210,"stem":211,"children":212,"icon":36},"Config","/config","3.config/0.index",[213],{"title":209,"path":210,"stem":211,"icon":36},{"title":215,"path":216,"stem":217,"children":218,"icon":220},"Examples","/examples","4.examples/0.index",[219],{"title":215,"path":216,"stem":217,"icon":220},"i-lucide-folder-code",{"title":5,"path":222,"stem":223},"/","index",{"id":225,"title":226,"body":227,"description":1218,"extension":1102,"meta":1219,"navigation":1220,"path":59,"seo":1221,"stem":60,"__hash__":1222},"content/1.docs/6.server-entry.md","Nitro Server Entry",{"type":228,"value":229,"toc":1209,"icon":61},"minimark",[230,237,246,255,272,275,541,554,557,579,583,604,865,869,876,923,927,934,1081,1091,1095,1098,1156,1164,1168,1172,1205],[231,232,233],"warning",{},[234,235,236],"p",{},"Nitro v3 Alpha docs are a work in progress — expect updates, rough edges, and occasional inaccuracies.",[234,238,239,240,245],{},"The server entry is a special handler in Nitro that acts as a global middleware, running for every incoming request before routes are matched (see ",[241,242,244],"a",{"href":243},"/docs/architecture#request-lifecycle","request lifecycle","). It's commonly used for cross-cutting concerns like authentication, logging, request preprocessing, or creating custom routing logic.",[247,248,250,251],"h2",{"id":249},"auto-detected-serverts","Auto-detected ",[252,253,254],"code",{},"server.ts",[234,256,257,258,260,261,264,265,264,268,271],{},"By default, Nitro automatically looks for a ",[252,259,254],{}," (or ",[252,262,263],{},".js",", ",[252,266,267],{},".mjs",[252,269,270],{},".tsx",", etc.) file in your project root or scan directories.",[234,273,274],{},"If found, Nitro will use it as the server entry and run it for all incoming requests.",[276,277,278,472],"code-group",{},[279,280,284],"pre",{"className":281,"code":282,"filename":254,"language":283,"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",[252,285,286,302,328,350,357,364,382,401,413,431,437,443,448,454,460,466],{"__ignoreMap":5},[287,288,291,295,298],"span",{"class":289,"line":290},"line",1,[287,292,294],{"class":293},"so5gQ","export",[287,296,297],{"class":293}," default",[287,299,301],{"class":300},"slsVL"," {\n",[287,303,305,308,312,315,319,322,325],{"class":289,"line":304},2,[287,306,307],{"class":293},"  async",[287,309,311],{"class":310},"shcOC"," fetch",[287,313,314],{"class":300},"(",[287,316,318],{"class":317},"sQHwn","req",[287,320,321],{"class":293},":",[287,323,324],{"class":310}," Request",[287,326,327],{"class":300},") {\n",[287,329,331,334,338,341,344,347],{"class":289,"line":330},3,[287,332,333],{"class":293},"    const",[287,335,337],{"class":336},"suiK_"," url",[287,339,340],{"class":293}," =",[287,342,343],{"class":293}," new",[287,345,346],{"class":310}," URL",[287,348,349],{"class":300},"(req.url);\n",[287,351,353],{"class":289,"line":352},4,[287,354,356],{"emptyLinePlaceholder":355},true,"\n",[287,358,360],{"class":289,"line":359},5,[287,361,363],{"class":362},"sCsY4","    // Handle specific routes\n",[287,365,367,370,373,376,380],{"class":289,"line":366},6,[287,368,369],{"class":293},"    if",[287,371,372],{"class":300}," (url.pathname ",[287,374,375],{"class":293},"===",[287,377,379],{"class":378},"sfrk1"," \"/health\"",[287,381,327],{"class":300},[287,383,385,388,390,393,395,398],{"class":289,"line":384},7,[287,386,387],{"class":293},"      return",[287,389,343],{"class":293},[287,391,392],{"class":310}," Response",[287,394,314],{"class":300},[287,396,397],{"class":378},"\"OK\"",[287,399,400],{"class":300},", {\n",[287,402,404,407,410],{"class":289,"line":403},8,[287,405,406],{"class":300},"        status: ",[287,408,409],{"class":336},"200",[287,411,412],{"class":300},",\n",[287,414,416,419,422,425,428],{"class":289,"line":415},9,[287,417,418],{"class":300},"        headers: { ",[287,420,421],{"class":378},"\"content-type\"",[287,423,424],{"class":300},": ",[287,426,427],{"class":378},"\"text/plain\"",[287,429,430],{"class":300}," }\n",[287,432,434],{"class":289,"line":433},10,[287,435,436],{"class":300},"      });\n",[287,438,440],{"class":289,"line":439},11,[287,441,442],{"class":300},"    }\n",[287,444,446],{"class":289,"line":445},12,[287,447,356],{"emptyLinePlaceholder":355},[287,449,451],{"class":289,"line":450},13,[287,452,453],{"class":362},"    // Add custom headers to all requests\n",[287,455,457],{"class":289,"line":456},14,[287,458,459],{"class":362},"    // Return nothing to continue to the next handler\n",[287,461,463],{"class":289,"line":462},15,[287,464,465],{"class":300},"  }\n",[287,467,469],{"class":289,"line":468},16,[287,470,471],{"class":300},"}\n",[279,473,476],{"className":281,"code":474,"filename":475,"language":283,"meta":5,"style":5},"import { defineHandler } from \"nitro/h3\";\n\nexport default defineHandler((event) => {\n  return { hello: \"API\" };\n});\n","routes/api/hello.ts",[252,477,478,495,499,522,536],{"__ignoreMap":5},[287,479,480,483,486,489,492],{"class":289,"line":290},[287,481,482],{"class":293},"import",[287,484,485],{"class":300}," { defineHandler } ",[287,487,488],{"class":293},"from",[287,490,491],{"class":378}," \"nitro/h3\"",[287,493,494],{"class":300},";\n",[287,496,497],{"class":289,"line":304},[287,498,356],{"emptyLinePlaceholder":355},[287,500,501,503,505,508,511,514,517,520],{"class":289,"line":330},[287,502,294],{"class":293},[287,504,297],{"class":293},[287,506,507],{"class":310}," defineHandler",[287,509,510],{"class":300},"((",[287,512,513],{"class":317},"event",[287,515,516],{"class":300},") ",[287,518,519],{"class":293},"=>",[287,521,301],{"class":300},[287,523,524,527,530,533],{"class":289,"line":352},[287,525,526],{"class":293},"  return",[287,528,529],{"class":300}," { hello: ",[287,531,532],{"class":378},"\"API\"",[287,534,535],{"class":300}," };\n",[287,537,538],{"class":289,"line":359},[287,539,540],{"class":300},"});\n",[542,543,544],"tip",{},[234,545,546,547,549,550,553],{},"When ",[252,548,254],{}," is detected, Nitro will automatically log in the terminal: ",[252,551,552],{},"Using \\","server.ts` as server entry.`",[234,555,556],{},"With this setup:",[558,559,560,567,573],"ul",{},[561,562,563,566],"li",{},[252,564,565],{},"/health"," → Handled by server entry",[561,568,569,572],{},[252,570,571],{},"/api/hello"," → Server entry runs first, then the API route",[561,574,575,578],{},[252,576,577],{},"/about",", etc. → Server entry runs first, then continues to routes or renderer",[247,580,582],{"id":581},"framework-compatibility","Framework compatibility",[234,584,585,586,264,592,597,598,603],{},"The server entry is a great way to integrate with other frameworks such as ",[241,587,591],{"href":588,"rel":589},"https://elysiajs.com/",[590],"nofollow","Elysia",[241,593,596],{"href":594,"rel":595},"https://hono.dev/",[590],"Hono"," or ",[241,599,602],{"href":600,"rel":601},"https://h3.dev/",[590],"H3",".",[605,606,607,693,785],"tabs",{},[608,609,611],"tabs-item",{"icon":610,"label":602},"i-undocs-h3",[279,612,614],{"className":281,"code":613,"filename":254,"language":283,"meta":5,"style":5},"import { H3 } from \"h3\";\n\nconst app = new H3()\n\napp.get(\"/\", () => \"⚡️ Hello from H3!\");\n\nexport default app;\n",[252,615,616,630,634,652,656,680,684],{"__ignoreMap":5},[287,617,618,620,623,625,628],{"class":289,"line":290},[287,619,482],{"class":293},[287,621,622],{"class":300}," { H3 } ",[287,624,488],{"class":293},[287,626,627],{"class":378}," \"h3\"",[287,629,494],{"class":300},[287,631,632],{"class":289,"line":304},[287,633,356],{"emptyLinePlaceholder":355},[287,635,636,639,642,644,646,649],{"class":289,"line":330},[287,637,638],{"class":293},"const",[287,640,641],{"class":336}," app",[287,643,340],{"class":293},[287,645,343],{"class":293},[287,647,648],{"class":310}," H3",[287,650,651],{"class":300},"()\n",[287,653,654],{"class":289,"line":352},[287,655,356],{"emptyLinePlaceholder":355},[287,657,658,661,664,666,669,672,674,677],{"class":289,"line":359},[287,659,660],{"class":300},"app.",[287,662,663],{"class":310},"get",[287,665,314],{"class":300},[287,667,668],{"class":378},"\"/\"",[287,670,671],{"class":300},", () ",[287,673,519],{"class":293},[287,675,676],{"class":378}," \"⚡️ Hello from H3!\"",[287,678,679],{"class":300},");\n",[287,681,682],{"class":289,"line":366},[287,683,356],{"emptyLinePlaceholder":355},[287,685,686,688,690],{"class":289,"line":384},[287,687,294],{"class":293},[287,689,297],{"class":293},[287,691,692],{"class":300}," app;\n",[608,694,696],{"icon":695,"label":596},"i-undocs-hono",[279,697,699],{"className":281,"code":698,"filename":254,"language":283,"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",[252,700,701,715,719,735,739,773,777],{"__ignoreMap":5},[287,702,703,705,708,710,713],{"class":289,"line":290},[287,704,482],{"class":293},[287,706,707],{"class":300}," { Hono } ",[287,709,488],{"class":293},[287,711,712],{"class":378}," \"hono\"",[287,714,494],{"class":300},[287,716,717],{"class":289,"line":304},[287,718,356],{"emptyLinePlaceholder":355},[287,720,721,723,725,727,729,732],{"class":289,"line":330},[287,722,638],{"class":293},[287,724,641],{"class":336},[287,726,340],{"class":293},[287,728,343],{"class":293},[287,730,731],{"class":310}," Hono",[287,733,734],{"class":300},"();\n",[287,736,737],{"class":289,"line":352},[287,738,356],{"emptyLinePlaceholder":355},[287,740,741,743,745,747,749,752,755,757,759,762,765,767,770],{"class":289,"line":359},[287,742,660],{"class":300},[287,744,663],{"class":310},[287,746,314],{"class":300},[287,748,668],{"class":378},[287,750,751],{"class":300},", (",[287,753,754],{"class":317},"c",[287,756,516],{"class":300},[287,758,519],{"class":293},[287,760,761],{"class":300}," c.",[287,763,764],{"class":310},"text",[287,766,314],{"class":300},[287,768,769],{"class":378},"\"🔥 Hello from Hono!\"",[287,771,772],{"class":300},"));\n",[287,774,775],{"class":289,"line":366},[287,776,356],{"emptyLinePlaceholder":355},[287,778,779,781,783],{"class":289,"line":384},[287,780,294],{"class":293},[287,782,297],{"class":293},[287,784,692],{"class":300},[608,786,788],{"icon":787,"label":591},"i-undocs-elysia",[279,789,791],{"className":281,"code":790,"filename":254,"language":283,"meta":5,"style":5},"import { Elysia } from \"elysia\";\n\nconst app = new Elysia();\n\napp.get(\"/\", (c) => \"🦊 Hello from Elysia!\");\n\nexport default app;\n",[252,792,793,807,811,826,830,853,857],{"__ignoreMap":5},[287,794,795,797,800,802,805],{"class":289,"line":290},[287,796,482],{"class":293},[287,798,799],{"class":300}," { Elysia } ",[287,801,488],{"class":293},[287,803,804],{"class":378}," \"elysia\"",[287,806,494],{"class":300},[287,808,809],{"class":289,"line":304},[287,810,356],{"emptyLinePlaceholder":355},[287,812,813,815,817,819,821,824],{"class":289,"line":330},[287,814,638],{"class":293},[287,816,641],{"class":336},[287,818,340],{"class":293},[287,820,343],{"class":293},[287,822,823],{"class":310}," Elysia",[287,825,734],{"class":300},[287,827,828],{"class":289,"line":352},[287,829,356],{"emptyLinePlaceholder":355},[287,831,832,834,836,838,840,842,844,846,848,851],{"class":289,"line":359},[287,833,660],{"class":300},[287,835,663],{"class":310},[287,837,314],{"class":300},[287,839,668],{"class":378},[287,841,751],{"class":300},[287,843,754],{"class":317},[287,845,516],{"class":300},[287,847,519],{"class":293},[287,849,850],{"class":378}," \"🦊 Hello from Elysia!\"",[287,852,679],{"class":300},[287,854,855],{"class":289,"line":366},[287,856,356],{"emptyLinePlaceholder":355},[287,858,859,861,863],{"class":289,"line":384},[287,860,294],{"class":293},[287,862,297],{"class":293},[287,864,692],{"class":300},[247,866,868],{"id":867},"custom-server-entry-file","Custom server entry file",[234,870,871,872,875],{},"You can specify a custom server entry file using the ",[252,873,874],{},"serverEntry"," option in your Nitro configuration.",[279,877,880],{"className":281,"code":878,"filename":879,"language":283,"meta":5,"style":5},"import { defineNitroConfig } from 'nitro/config'\n\nexport default defineNitroConfig({\n  serverEntry: './nitro.server.ts'\n})\n","nitro.config.ts",[252,881,882,894,898,910,918],{"__ignoreMap":5},[287,883,884,886,889,891],{"class":289,"line":290},[287,885,482],{"class":293},[287,887,888],{"class":300}," { defineNitroConfig } ",[287,890,488],{"class":293},[287,892,893],{"class":378}," 'nitro/config'\n",[287,895,896],{"class":289,"line":304},[287,897,356],{"emptyLinePlaceholder":355},[287,899,900,902,904,907],{"class":289,"line":330},[287,901,294],{"class":293},[287,903,297],{"class":293},[287,905,906],{"class":310}," defineNitroConfig",[287,908,909],{"class":300},"({\n",[287,911,912,915],{"class":289,"line":352},[287,913,914],{"class":300},"  serverEntry: ",[287,916,917],{"class":378},"'./nitro.server.ts'\n",[287,919,920],{"class":289,"line":359},[287,921,922],{"class":300},"})\n",[247,924,926],{"id":925},"using-event-handler","Using event handler",[234,928,929,930,933],{},"You can also export an event handler using ",[252,931,932],{},"defineHandler"," for better type inference and access to the h3 event object:",[279,935,937],{"className":281,"code":936,"filename":254,"language":283,"meta":5,"style":5},"import { defineHandler } from \"nitro/h3\";\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",[252,938,939,951,955,973,978,994,1009,1013,1018,1068,1072,1077],{"__ignoreMap":5},[287,940,941,943,945,947,949],{"class":289,"line":290},[287,942,482],{"class":293},[287,944,485],{"class":300},[287,946,488],{"class":293},[287,948,491],{"class":378},[287,950,494],{"class":300},[287,952,953],{"class":289,"line":304},[287,954,356],{"emptyLinePlaceholder":355},[287,956,957,959,961,963,965,967,969,971],{"class":289,"line":330},[287,958,294],{"class":293},[287,960,297],{"class":293},[287,962,507],{"class":310},[287,964,510],{"class":300},[287,966,513],{"class":317},[287,968,516],{"class":300},[287,970,519],{"class":293},[287,972,301],{"class":300},[287,974,975],{"class":289,"line":352},[287,976,977],{"class":362},"  // Add custom context\n",[287,979,980,983,986,989,992],{"class":289,"line":359},[287,981,982],{"class":300},"  event.context.requestId ",[287,984,985],{"class":293},"=",[287,987,988],{"class":300}," crypto.",[287,990,991],{"class":310},"randomUUID",[287,993,734],{"class":300},[287,995,996,999,1001,1004,1007],{"class":289,"line":366},[287,997,998],{"class":300},"  event.context.timestamp ",[287,1000,985],{"class":293},[287,1002,1003],{"class":300}," Date.",[287,1005,1006],{"class":310},"now",[287,1008,734],{"class":300},[287,1010,1011],{"class":289,"line":384},[287,1012,356],{"emptyLinePlaceholder":355},[287,1014,1015],{"class":289,"line":403},[287,1016,1017],{"class":362},"  // Log the request\n",[287,1019,1020,1023,1026,1028,1031,1033,1035,1038,1040,1043,1046,1048,1050,1053,1056,1058,1060,1063,1066],{"class":289,"line":415},[287,1021,1022],{"class":300},"  console.",[287,1024,1025],{"class":310},"log",[287,1027,314],{"class":300},[287,1029,1030],{"class":378},"`[${",[287,1032,513],{"class":300},[287,1034,603],{"class":378},[287,1036,1037],{"class":300},"context",[287,1039,603],{"class":378},[287,1041,1042],{"class":300},"requestId",[287,1044,1045],{"class":378},"}] ${",[287,1047,513],{"class":300},[287,1049,603],{"class":378},[287,1051,1052],{"class":300},"method",[287,1054,1055],{"class":378},"} ${",[287,1057,513],{"class":300},[287,1059,603],{"class":378},[287,1061,1062],{"class":300},"path",[287,1064,1065],{"class":378},"}`",[287,1067,679],{"class":300},[287,1069,1070],{"class":289,"line":433},[287,1071,356],{"emptyLinePlaceholder":355},[287,1073,1074],{"class":289,"line":439},[287,1075,1076],{"class":362},"  // Continue to the next handler (don't return anything)\n",[287,1078,1079],{"class":289,"line":445},[287,1080,540],{"class":300},[1082,1083,1084],"important",{},[234,1085,1086,1087,1090],{},"If your server entry returns ",[252,1088,1089],{},"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.",[247,1092,1094],{"id":1093},"request-lifecycle","Request lifecycle",[234,1096,1097],{},"The server entry is called as part of the global middleware stack, after route rules but before route handlers:",[279,1099,1103],{"className":1100,"code":1101,"language":1102,"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. Server entry ← You are here\n5. Routes (routes/)\n6. Renderer (renderer.ts or index.html)\n","md",[252,1104,1105,1116,1124,1132,1140,1148],{"__ignoreMap":5},[287,1106,1107,1110,1113],{"class":289,"line":290},[287,1108,1109],{"class":317},"1.",[287,1111,1112],{"class":300}," Server hook: ",[287,1114,1115],{"class":336},"`request`\n",[287,1117,1118,1121],{"class":289,"line":304},[287,1119,1120],{"class":317},"2.",[287,1122,1123],{"class":300}," Route rules (headers, redirects, etc.)\n",[287,1125,1126,1129],{"class":289,"line":330},[287,1127,1128],{"class":317},"3.",[287,1130,1131],{"class":300}," Global middleware (middleware/)\n",[287,1133,1134,1137],{"class":289,"line":352},[287,1135,1136],{"class":317},"4.",[287,1138,1139],{"class":300}," Server entry ← You are here\n",[287,1141,1142,1145],{"class":289,"line":359},[287,1143,1144],{"class":317},"5.",[287,1146,1147],{"class":300}," Routes (routes/)\n",[287,1149,1150,1153],{"class":289,"line":366},[287,1151,1152],{"class":317},"6.",[287,1154,1155],{"class":300}," Renderer (renderer.ts or index.html)\n",[234,1157,1158,1159,1163],{},"Think of the server entry as the ",[1160,1161,1162],"strong",{},"last global middleware"," to run before route matching.",[1165,1166],"read-more",{"title":1167,"to":243},"Architecture > Request lifecycle",[247,1169,1171],{"id":1170},"best-practices","Best practices",[558,1173,1174,1180,1186,1189,1192,1199,1202],{},[561,1175,1176,1177],{},"Use server entry for cross-cutting concerns that affect ",[1160,1178,1179],{},"all routes",[561,1181,1182,1183,1185],{},"Return ",[252,1184,1089],{}," to continue processing, return a response to terminate",[561,1187,1188],{},"Keep server entry logic lightweight for better performance",[561,1190,1191],{},"Use global middleware for modular concerns instead of one large server entry",[561,1193,1194,1195,1198],{},"Consider using ",[241,1196,1197],{"href":49},"Nitro plugins"," for initialization logic",[561,1200,1201],{},"Avoid heavy computation in server entry (it runs for every request)",[561,1203,1204],{},"Don't use server entry for route-specific logic (use route handlers instead as they are more performant)",[1206,1207,1208],"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":304,"depth":304,"links":1210},[1211,1213,1214,1215,1216,1217],{"id":249,"depth":304,"text":1212},"Auto-detected server.ts",{"id":581,"depth":304,"text":582},{"id":867,"depth":304,"text":868},{"id":925,"depth":304,"text":926},{"id":1093,"depth":304,"text":1094},{"id":1170,"depth":304,"text":1171},"Use a server entry to create a global middleware that runs for all routes before they are matched.",{"icon":61},{"title":58,"icon":61},{"title":226,"description":1218},"yK9J27aKNqPixbSy0VIX_tJTTmrMzS9FBiZnJ-Xi50E",[1224,1226],{"title":53,"path":54,"stem":55,"description":1225,"icon":56,"children":-1},"Nitro tasks allow on-off operations in runtime.",{"title":63,"path":64,"stem":65,"description":1227,"icon":66,"children":-1},"Nitro provides a caching system built on top of the storage layer.",1773050448416]