[{"data":1,"prerenderedAt":1017},["ShallowReactive",2],{"navigation":3,"-guide":61,"-guide-surround":1013},[4],{"title":5,"path":6,"stem":7,"children":8,"icon":10},"Getting Started","/guide","1.guide/01.index",[9,11,16,21,26,31,36,41,46,51,56],{"title":5,"path":6,"stem":7,"icon":10},"ph:book-open-duotone",{"title":12,"path":13,"stem":14,"icon":15},"Fetch Handler","/guide/handler","1.guide/02.handler","i-fluent:target-24-regular",{"title":17,"path":18,"stem":19,"icon":20},"Server Instance","/guide/server","1.guide/03.server","radix-icons:component-instance",{"title":22,"path":23,"stem":24,"icon":25},"Middleware","/guide/middleware","1.guide/04.middleware","clarity:plugin-line",{"title":27,"path":28,"stem":29,"icon":30},"Server Options","/guide/options","1.guide/05.options","ri:settings-3-line",{"title":32,"path":33,"stem":34,"icon":35},"TLS","/guide/tls","1.guide/06.tls","ri:lock-2-line",{"title":37,"path":38,"stem":39,"icon":40},"Bundler Usage","/guide/bundler","1.guide/07.bundler","clarity:bundle-line",{"title":42,"path":43,"stem":44,"icon":45},"Node.js Support","/guide/node","1.guide/08.node","akar-icons:node-fill",{"title":47,"path":48,"stem":49,"icon":50},"Using CLI","/guide/cli","1.guide/10.cli","garden:terminal-cli-stroke-12",{"title":52,"path":53,"stem":54,"icon":55},"Body Size Limiting","/guide/body-limit","1.guide/11.body-limit","ri:scales-3-line",{"title":57,"path":58,"stem":59,"icon":60},"AWS Lambda","/guide/aws-lambda","1.guide/9.aws-lambda","clarity:cloud-traffic-line",{"id":62,"title":5,"body":63,"description":1007,"extension":1008,"meta":1009,"navigation":1010,"path":6,"seo":1011,"stem":7,"__hash__":1012},"content/1.guide/01.index.md",{"type":64,"value":65,"toc":1001,"icon":10},"minimark",[66,71,75,159,162,243,247,260,264,275,277,358,364,367,369,419,423,430,525,558,619,640,652,729,733,997],[67,68,70],"h2",{"id":69},"quick-start-cli","Quick Start (CLI)",[72,73,74],"p",{},"Create a server entry:",[76,77,83],"pre",{"className":78,"code":79,"filename":80,"language":81,"meta":82,"style":82},"language-js shiki shiki-themes github-light github-dark github-dark","export default {\n  fetch(req: Request) {\n    return Response.json({ hello: \"world!\" });\n  },\n};\n","server.ts","js","",[84,85,86,102,125,147,153],"code",{"__ignoreMap":82},[87,88,91,95,98],"span",{"class":89,"line":90},"line",1,[87,92,94],{"class":93},"so5gQ","export",[87,96,97],{"class":93}," default",[87,99,101],{"class":100},"slsVL"," {\n",[87,103,105,109,112,116,119,122],{"class":89,"line":104},2,[87,106,108],{"class":107},"shcOC","  fetch",[87,110,111],{"class":100},"(",[87,113,115],{"class":114},"sQHwn","req",[87,117,118],{"class":93},":",[87,120,121],{"class":107}," Request",[87,123,124],{"class":100},") {\n",[87,126,128,131,134,137,140,144],{"class":89,"line":127},3,[87,129,130],{"class":93},"    return",[87,132,133],{"class":100}," Response.",[87,135,136],{"class":107},"json",[87,138,139],{"class":100},"({ hello: ",[87,141,143],{"class":142},"sfrk1","\"world!\"",[87,145,146],{"class":100}," });\n",[87,148,150],{"class":89,"line":149},4,[87,151,152],{"class":100},"  },\n",[87,154,156],{"class":89,"line":155},5,[87,157,158],{"class":100},"};\n",[72,160,161],{},"Then, run the server using your favorite runtime:",[163,164,165,181,194,209,227],"CodeGroup",{},[76,166,171],{"className":167,"code":168,"filename":169,"language":170,"meta":82,"style":82},"language-bash shiki shiki-themes github-light github-dark github-dark","npx srvx\n","npm","bash",[84,172,173],{"__ignoreMap":82},[87,174,175,178],{"class":89,"line":90},[87,176,177],{"class":107},"npx",[87,179,180],{"class":142}," srvx\n",[76,182,185],{"className":167,"code":183,"filename":184,"language":170,"meta":82,"style":82},"pnpx srvx\n","pnpm",[84,186,187],{"__ignoreMap":82},[87,188,189,192],{"class":89,"line":90},[87,190,191],{"class":107},"pnpx",[87,193,180],{"class":142},[76,195,198],{"className":167,"code":196,"filename":197,"language":170,"meta":82,"style":82},"yarn dlx srvx\n","yarn",[84,199,200],{"__ignoreMap":82},[87,201,202,204,207],{"class":89,"line":90},[87,203,197],{"class":107},[87,205,206],{"class":142}," dlx",[87,208,180],{"class":142},[76,210,213],{"className":167,"code":211,"filename":212,"language":170,"meta":82,"style":82},"deno -A npm:srvx\n","Deno",[84,214,215],{"__ignoreMap":82},[87,216,217,220,224],{"class":89,"line":90},[87,218,219],{"class":107},"deno",[87,221,223],{"class":222},"suiK_"," -A",[87,225,226],{"class":142}," npm:srvx\n",[76,228,231],{"className":167,"code":229,"filename":230,"language":170,"meta":82,"style":82},"bunx --bun srvx\n","Bun",[84,232,233],{"__ignoreMap":82},[87,234,235,238,241],{"class":89,"line":90},[87,236,237],{"class":107},"bunx",[87,239,240],{"class":222}," --bun",[87,242,180],{"class":142},[244,245],"read-more",{"title":47,"to":246},"/guide/cli#usage",[248,249,250],"tip",{},[72,251,252,253],{},"\nYou can also try examples in the ",[254,255,259],"a",{"href":256,"rel":257},"https://stackblitz.com/fork/github/h3js/srvx/tree/main/examples/stackblitz?startScript=dev&file=server.mjs",[258],"nofollow","online playground",[67,261,263],{"id":262},"quick-start-api","Quick Start (API)",[72,265,266,267,270,271,274],{},"Instead of using the ",[84,268,269],{},"srvx"," CLI, you can directly import the ",[84,272,273],{},"serve"," method to define a self-listening server entry.",[72,276,74],{},[76,278,280],{"className":78,"code":279,"filename":80,"language":81,"meta":82,"style":82},"import { serve } from \"srvx\";\n\nconst server = serve({\n  fetch(request) {\n    return Response.json({ hello: \"world!\" });\n  },\n});\n",[84,281,282,299,305,322,333,347,352],{"__ignoreMap":82},[87,283,284,287,290,293,296],{"class":89,"line":90},[87,285,286],{"class":93},"import",[87,288,289],{"class":100}," { serve } ",[87,291,292],{"class":93},"from",[87,294,295],{"class":142}," \"srvx\"",[87,297,298],{"class":100},";\n",[87,300,301],{"class":89,"line":104},[87,302,304],{"emptyLinePlaceholder":303},true,"\n",[87,306,307,310,313,316,319],{"class":89,"line":127},[87,308,309],{"class":93},"const",[87,311,312],{"class":222}," server",[87,314,315],{"class":93}," =",[87,317,318],{"class":107}," serve",[87,320,321],{"class":100},"({\n",[87,323,324,326,328,331],{"class":89,"line":149},[87,325,108],{"class":107},[87,327,111],{"class":100},[87,329,330],{"class":114},"request",[87,332,124],{"class":100},[87,334,335,337,339,341,343,345],{"class":89,"line":155},[87,336,130],{"class":93},[87,338,133],{"class":100},[87,340,136],{"class":107},[87,342,139],{"class":100},[87,344,143],{"class":142},[87,346,146],{"class":100},[87,348,350],{"class":89,"line":349},6,[87,351,152],{"class":100},[87,353,355],{"class":89,"line":354},7,[87,356,357],{"class":100},"});\n",[72,359,360,361,363],{},"Install ",[84,362,269],{}," as a dependency:",[365,366],"pm-install",{"name":269},[72,368,161],{},[370,371,372,385,405],"code-group",{},[76,373,376],{"className":167,"code":374,"filename":375,"language":170,"meta":82,"style":82},"node server.mjs\n","node",[84,377,378],{"__ignoreMap":82},[87,379,380,382],{"class":89,"line":90},[87,381,375],{"class":107},[87,383,384],{"class":142}," server.mjs\n",[76,386,388],{"className":167,"code":387,"filename":219,"language":170,"meta":82,"style":82},"deno run --allow-env --allow-net server.mjs\n",[84,389,390],{"__ignoreMap":82},[87,391,392,394,397,400,403],{"class":89,"line":90},[87,393,219],{"class":107},[87,395,396],{"class":142}," run",[87,398,399],{"class":222}," --allow-env",[87,401,402],{"class":222}," --allow-net",[87,404,384],{"class":142},[76,406,409],{"className":167,"code":407,"filename":408,"language":170,"meta":82,"style":82},"bun run server.mjs\n","bun",[84,410,411],{"__ignoreMap":82},[87,412,413,415,417],{"class":89,"line":90},[87,414,408],{"class":107},[87,416,396],{"class":142},[87,418,384],{"class":142},[67,420,422],{"id":421},"typescript","TypeScript",[72,424,425,426,429],{},"Each entry only pulls in the types of the runtime it targets. The ambient type packages below are declared as optional ",[84,427,428],{},"peerDependencies",", so nothing is installed unless you ask for it:",[431,432,433,449],"table",{},[434,435,436],"thead",{},[437,438,439,443,446],"tr",{},[440,441,442],"th",{},"Runtime",[440,444,445],{},"Types package",[440,447,448],{},"Needed by",[450,451,452,468,482,496,511],"tbody",{},[437,453,454,458,463],{},[455,456,457],"td",{},"Node.js",[455,459,460],{},[84,461,462],{},"@types/node",[455,464,465],{},[84,466,467],{},"srvx/node",[437,469,470,472,477],{},[455,471,212],{},[455,473,474],{},[84,475,476],{},"@types/deno",[455,478,479],{},[84,480,481],{},"srvx/deno",[437,483,484,486,491],{},[455,485,230],{},[455,487,488],{},[84,489,490],{},"@types/bun",[455,492,493],{},[84,494,495],{},"srvx/bun",[437,497,498,501,506],{},[455,499,500],{},"Cloudflare Workers",[455,502,503],{},[84,504,505],{},"@cloudflare/workers-types",[455,507,508],{},[84,509,510],{},"srvx/cloudflare",[437,512,513,515,520],{},[455,514,57],{},[455,516,517],{},[84,518,519],{},"@types/aws-lambda",[455,521,522],{},[84,523,524],{},"srvx/aws-lambda",[72,526,527,528,531,532,531,535,531,538,531,541,531,544,531,547,550,551,554,555,118],{},"Everything else — ",[84,529,530],{},"srvx/types",", ",[84,533,534],{},"srvx/service-worker",[84,536,537],{},"srvx/static",[84,539,540],{},"srvx/log",[84,542,543],{},"srvx/body-limit",[84,545,546],{},"srvx/tracing",[84,548,549],{},"srvx/mtls"," and ",[84,552,553],{},"srvx/cli"," — needs none of them, so a project can type check with ",[84,556,557],{},"skipLibCheck: false",[76,559,563],{"className":560,"code":561,"filename":80,"language":562,"meta":82,"style":82},"language-ts shiki shiki-themes github-light github-dark github-dark","import { serve } from \"srvx/node\"; // only needs `@types/node`\nimport { staticMiddleware } from \"srvx/static\"; // needs nothing\nimport type { ServerRequest } from \"srvx/types\"; // needs nothing\n","ts",[84,564,565,583,600],{"__ignoreMap":82},[87,566,567,569,571,573,576,579],{"class":89,"line":90},[87,568,286],{"class":93},[87,570,289],{"class":100},[87,572,292],{"class":93},[87,574,575],{"class":142}," \"srvx/node\"",[87,577,578],{"class":100},"; ",[87,580,582],{"class":581},"sCsY4","// only needs `@types/node`\n",[87,584,585,587,590,592,595,597],{"class":89,"line":104},[87,586,286],{"class":93},[87,588,589],{"class":100}," { staticMiddleware } ",[87,591,292],{"class":93},[87,593,594],{"class":142}," \"srvx/static\"",[87,596,578],{"class":100},[87,598,599],{"class":581},"// needs nothing\n",[87,601,602,604,607,610,612,615,617],{"class":89,"line":127},[87,603,286],{"class":93},[87,605,606],{"class":93}," type",[87,608,609],{"class":100}," { ServerRequest } ",[87,611,292],{"class":93},[87,613,614],{"class":142}," \"srvx/types\"",[87,616,578],{"class":100},[87,618,599],{"class":581},[72,620,621,622,531,625,628,629,631,632,635,636,639],{},"Runtime specific fields such as ",[84,623,624],{},"server.node",[84,626,627],{},"request.runtime.deno"," or the ",[84,630,408],{}," option are typed as soon as the types of that runtime are loaded, and stay loosely typed (",[84,633,634],{},"Record\u003Cstring, unknown>",") otherwise — importing ",[84,637,638],{},"srvx/\u003Cruntime>"," anywhere in your project is enough to type them everywhere.",[641,642,643],"note",{},[72,644,645,647,648,651],{},[84,646,476],{}," references DOM types, so pair it with ",[84,649,650],{},"lib: [\"esnext\", \"dom\"]",".",[641,653,654,676],{},[72,655,656,657,659,660,663,664,666,667,670,671,673,674,118],{},"\nThe universal ",[84,658,269],{}," entry covers every runtime, so it resolves all of the packages above at once. It also references ",[84,661,662],{},"cloudflare:workers",", which ",[84,665,505],{}," declares ambiently and therefore only resolves when that package is listed in tsconfig ",[84,668,669],{},"types"," — which in turn conflicts with ",[84,672,476],{},". Declare the module yourself to check that entry with ",[84,675,557],{},[76,677,679],{"className":560,"code":678,"language":562,"meta":82,"style":82},"declare module \"cloudflare:workers\" {\n  export const env: Record\u003Cstring, unknown>;\n}\n",[84,680,681,694,724],{"__ignoreMap":82},[87,682,683,686,689,692],{"class":89,"line":90},[87,684,685],{"class":93},"declare",[87,687,688],{"class":93}," module",[87,690,691],{"class":142}," \"cloudflare:workers\"",[87,693,101],{"class":100},[87,695,696,699,702,705,707,710,713,716,718,721],{"class":89,"line":104},[87,697,698],{"class":93},"  export",[87,700,701],{"class":93}," const",[87,703,704],{"class":222}," env",[87,706,118],{"class":93},[87,708,709],{"class":107}," Record",[87,711,712],{"class":100},"\u003C",[87,714,715],{"class":222},"string",[87,717,531],{"class":100},[87,719,720],{"class":222},"unknown",[87,722,723],{"class":100},">;\n",[87,725,726],{"class":89,"line":127},[87,727,728],{"class":100},"}\n",[67,730,732],{"id":731},"starter-examples","Starter Examples",[431,734,735,748],{},[434,736,737],{},[437,738,739,742,745],{},[440,740,741],{},"Example",[440,743,744],{},"Source",[440,746,747],{},"Try",[450,749,750,769,788,807,826,845,864,883,902,921,940,959,978],{},[437,751,752,757,764],{},[455,753,754],{},[84,755,756],{},"aws-lambda",[455,758,759],{},[254,760,763],{"href":761,"rel":762},"https://github.com/h3js/srvx/tree/main/examples/aws-lambda/",[258],"examples/aws-lambda",[455,765,766],{},[84,767,768],{},"npx giget gh:h3js/srvx/examples/aws-lambda srvx-aws-lambda",[437,770,771,776,783],{},[455,772,773],{},[84,774,775],{},"elysia",[455,777,778],{},[254,779,782],{"href":780,"rel":781},"https://github.com/h3js/srvx/tree/main/examples/elysia/",[258],"examples/elysia",[455,784,785],{},[84,786,787],{},"npx giget gh:h3js/srvx/examples/elysia srvx-elysia",[437,789,790,795,802],{},[455,791,792],{},[84,793,794],{},"express",[455,796,797],{},[254,798,801],{"href":799,"rel":800},"https://github.com/h3js/srvx/tree/main/examples/express/",[258],"examples/express",[455,803,804],{},[84,805,806],{},"npx giget gh:h3js/srvx/examples/express srvx-express",[437,808,809,814,821],{},[455,810,811],{},[84,812,813],{},"fastify",[455,815,816],{},[254,817,820],{"href":818,"rel":819},"https://github.com/h3js/srvx/tree/main/examples/fastify/",[258],"examples/fastify",[455,822,823],{},[84,824,825],{},"npx giget gh:h3js/srvx/examples/fastify srvx-fastify",[437,827,828,833,840],{},[455,829,830],{},[84,831,832],{},"h3",[455,834,835],{},[254,836,839],{"href":837,"rel":838},"https://github.com/h3js/srvx/tree/main/examples/h3/",[258],"examples/h3",[455,841,842],{},[84,843,844],{},"npx giget gh:h3js/srvx/examples/h3 srvx-h3",[437,846,847,852,859],{},[455,848,849],{},[84,850,851],{},"hello-world",[455,853,854],{},[254,855,858],{"href":856,"rel":857},"https://github.com/h3js/srvx/tree/main/examples/hello-world/",[258],"examples/hello-world",[455,860,861],{},[84,862,863],{},"npx giget gh:h3js/srvx/examples/hello-world srvx-hello-world",[437,865,866,871,878],{},[455,867,868],{},[84,869,870],{},"hono",[455,872,873],{},[254,874,877],{"href":875,"rel":876},"https://github.com/h3js/srvx/tree/main/examples/hono/",[258],"examples/hono",[455,879,880],{},[84,881,882],{},"npx giget gh:h3js/srvx/examples/hono srvx-hono",[437,884,885,890,897],{},[455,886,887],{},[84,888,889],{},"jsx",[455,891,892],{},[254,893,896],{"href":894,"rel":895},"https://github.com/h3js/srvx/tree/main/examples/jsx/",[258],"examples/jsx",[455,898,899],{},[84,900,901],{},"npx giget gh:h3js/srvx/examples/jsx srvx-jsx",[437,903,904,909,916],{},[455,905,906],{},[84,907,908],{},"node-handler",[455,910,911],{},[254,912,915],{"href":913,"rel":914},"https://github.com/h3js/srvx/tree/main/examples/node-handler/",[258],"examples/node-handler",[455,917,918],{},[84,919,920],{},"npx giget gh:h3js/srvx/examples/node-handler srvx-node-handler",[437,922,923,928,935],{},[455,924,925],{},[84,926,927],{},"service-worker",[455,929,930],{},[254,931,934],{"href":932,"rel":933},"https://github.com/h3js/srvx/tree/main/examples/service-worker/",[258],"examples/service-worker",[455,936,937],{},[84,938,939],{},"npx giget gh:h3js/srvx/examples/service-worker srvx-service-worker",[437,941,942,947,954],{},[455,943,944],{},[84,945,946],{},"streaming",[455,948,949],{},[254,950,953],{"href":951,"rel":952},"https://github.com/h3js/srvx/tree/main/examples/streaming/",[258],"examples/streaming",[455,955,956],{},[84,957,958],{},"npx giget gh:h3js/srvx/examples/streaming srvx-streaming",[437,960,961,966,973],{},[455,962,963],{},[84,964,965],{},"tracing",[455,967,968],{},[254,969,972],{"href":970,"rel":971},"https://github.com/h3js/srvx/tree/main/examples/tracing/",[258],"examples/tracing",[455,974,975],{},[84,976,977],{},"npx giget gh:h3js/srvx/examples/tracing srvx-tracing",[437,979,980,985,992],{},[455,981,982],{},[84,983,984],{},"websocket",[455,986,987],{},[254,988,991],{"href":989,"rel":990},"https://github.com/h3js/srvx/tree/main/examples/websocket/",[258],"examples/websocket",[455,993,994],{},[84,995,996],{},"npx giget gh:h3js/srvx/examples/websocket srvx-websocket",[998,999,1000],"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 .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);}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}",{"title":82,"searchDepth":104,"depth":104,"links":1002},[1003,1004,1005,1006],{"id":69,"depth":104,"text":70},{"id":262,"depth":104,"text":263},{"id":421,"depth":104,"text":422},{"id":731,"depth":104,"text":732},"Build HTTP servers with web standard APIs like fetch, Request, and Response.","md",{"automd":303,"icon":10},{"icon":10},{"title":5,"description":1007},"vrKcbonmK9Esoki3xIsvKGcvfRQyIfRdwkCG347g4E8",[1014,1015],null,{"title":12,"path":13,"stem":14,"description":1016,"icon":15,"children":-1},"Get familiar with srvx fetch server handler and ServerRequest.",1785330056629]