[{"data":1,"prerenderedAt":855},["ShallowReactive",2],{"navigation":3,"-guide":61,"-guide-surround":851},[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":845,"extension":846,"meta":847,"navigation":848,"path":6,"seo":849,"stem":7,"__hash__":850},"content/1.guide/01.index.md",{"type":64,"value":65,"toc":839,"icon":10},"minimark",[66,71,75,159,162,243,247,260,264,275,277,358,364,367,369,419,423,430,507,519,567,571,835],[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],{},"srvx ships one shared set of type definitions covering every supported runtime. The runtime types they reference come from ambient type packages, declared as optional ",[84,427,428],{},"peerDependencies"," so that nothing is installed unless you ask for it:",[431,432,433,446],"table",{},[434,435,436],"thead",{},[437,438,439,443],"tr",{},[440,441,442],"th",{},"Runtime",[440,444,445],{},"Types package",[447,448,449,460,469,478,488,497],"tbody",{},[437,450,451,455],{},[452,453,454],"td",{},"Node.js",[452,456,457],{},[84,458,459],{},"@types/node",[437,461,462,464],{},[452,463,212],{},[452,465,466],{},[84,467,468],{},"@types/deno",[437,470,471,473],{},[452,472,230],{},[452,474,475],{},[84,476,477],{},"@types/bun",[437,479,480,483],{},[452,481,482],{},"Cloudflare Workers",[452,484,485],{},[84,486,487],{},"@cloudflare/workers-types",[437,489,490,492],{},[452,491,57],{},[452,493,494],{},[84,495,496],{},"@types/aws-lambda",[437,498,499,502],{},[452,500,501],{},"Service Worker",[452,503,504],{},[84,505,506],{},"@types/serviceworker",[508,509,510],"note",{},[72,511,512,514,515,518],{},[84,513,468],{}," references DOM types, so pair it with ",[84,516,517],{},"lib: [\"esnext\", \"dom\"]",".",[508,520,521],{},[72,522,523,524,527,528,531,532,534,535,538,539,538,542,545,546,548,549,551,552,555,556,558,559,562,563,566],{},"\nBecause the definitions are shared, ",[84,525,526],{},"tsc"," with ",[84,529,530],{},"skipLibCheck: false"," also resolves the references of runtimes you do not target and reports the missing ones. Installing all of them is not a way out — ",[84,533,506],{}," redeclares globals (",[84,536,537],{},"Blob",", ",[84,540,541],{},"Request",[84,543,544],{},"GPU*",", …) that ",[84,547,477],{}," and ",[84,550,468],{}," declare too, and TypeScript's own ",[84,553,554],{},"lib: [\"webworker\"]"," collides with ",[84,557,477],{}," the same way — so keep ",[84,560,561],{},"skipLibCheck: true"," (what ",[84,564,565],{},"tsc --init"," generates).",[67,568,570],{"id":569},"starter-examples","Starter Examples",[431,572,573,586],{},[434,574,575],{},[437,576,577,580,583],{},[440,578,579],{},"Example",[440,581,582],{},"Source",[440,584,585],{},"Try",[447,587,588,607,626,645,664,683,702,721,740,759,778,797,816],{},[437,589,590,595,602],{},[452,591,592],{},[84,593,594],{},"aws-lambda",[452,596,597],{},[254,598,601],{"href":599,"rel":600},"https://github.com/h3js/srvx/tree/main/examples/aws-lambda/",[258],"examples/aws-lambda",[452,603,604],{},[84,605,606],{},"npx giget gh:h3js/srvx/examples/aws-lambda srvx-aws-lambda",[437,608,609,614,621],{},[452,610,611],{},[84,612,613],{},"elysia",[452,615,616],{},[254,617,620],{"href":618,"rel":619},"https://github.com/h3js/srvx/tree/main/examples/elysia/",[258],"examples/elysia",[452,622,623],{},[84,624,625],{},"npx giget gh:h3js/srvx/examples/elysia srvx-elysia",[437,627,628,633,640],{},[452,629,630],{},[84,631,632],{},"express",[452,634,635],{},[254,636,639],{"href":637,"rel":638},"https://github.com/h3js/srvx/tree/main/examples/express/",[258],"examples/express",[452,641,642],{},[84,643,644],{},"npx giget gh:h3js/srvx/examples/express srvx-express",[437,646,647,652,659],{},[452,648,649],{},[84,650,651],{},"fastify",[452,653,654],{},[254,655,658],{"href":656,"rel":657},"https://github.com/h3js/srvx/tree/main/examples/fastify/",[258],"examples/fastify",[452,660,661],{},[84,662,663],{},"npx giget gh:h3js/srvx/examples/fastify srvx-fastify",[437,665,666,671,678],{},[452,667,668],{},[84,669,670],{},"h3",[452,672,673],{},[254,674,677],{"href":675,"rel":676},"https://github.com/h3js/srvx/tree/main/examples/h3/",[258],"examples/h3",[452,679,680],{},[84,681,682],{},"npx giget gh:h3js/srvx/examples/h3 srvx-h3",[437,684,685,690,697],{},[452,686,687],{},[84,688,689],{},"hello-world",[452,691,692],{},[254,693,696],{"href":694,"rel":695},"https://github.com/h3js/srvx/tree/main/examples/hello-world/",[258],"examples/hello-world",[452,698,699],{},[84,700,701],{},"npx giget gh:h3js/srvx/examples/hello-world srvx-hello-world",[437,703,704,709,716],{},[452,705,706],{},[84,707,708],{},"hono",[452,710,711],{},[254,712,715],{"href":713,"rel":714},"https://github.com/h3js/srvx/tree/main/examples/hono/",[258],"examples/hono",[452,717,718],{},[84,719,720],{},"npx giget gh:h3js/srvx/examples/hono srvx-hono",[437,722,723,728,735],{},[452,724,725],{},[84,726,727],{},"jsx",[452,729,730],{},[254,731,734],{"href":732,"rel":733},"https://github.com/h3js/srvx/tree/main/examples/jsx/",[258],"examples/jsx",[452,736,737],{},[84,738,739],{},"npx giget gh:h3js/srvx/examples/jsx srvx-jsx",[437,741,742,747,754],{},[452,743,744],{},[84,745,746],{},"node-handler",[452,748,749],{},[254,750,753],{"href":751,"rel":752},"https://github.com/h3js/srvx/tree/main/examples/node-handler/",[258],"examples/node-handler",[452,755,756],{},[84,757,758],{},"npx giget gh:h3js/srvx/examples/node-handler srvx-node-handler",[437,760,761,766,773],{},[452,762,763],{},[84,764,765],{},"service-worker",[452,767,768],{},[254,769,772],{"href":770,"rel":771},"https://github.com/h3js/srvx/tree/main/examples/service-worker/",[258],"examples/service-worker",[452,774,775],{},[84,776,777],{},"npx giget gh:h3js/srvx/examples/service-worker srvx-service-worker",[437,779,780,785,792],{},[452,781,782],{},[84,783,784],{},"streaming",[452,786,787],{},[254,788,791],{"href":789,"rel":790},"https://github.com/h3js/srvx/tree/main/examples/streaming/",[258],"examples/streaming",[452,793,794],{},[84,795,796],{},"npx giget gh:h3js/srvx/examples/streaming srvx-streaming",[437,798,799,804,811],{},[452,800,801],{},[84,802,803],{},"tracing",[452,805,806],{},[254,807,810],{"href":808,"rel":809},"https://github.com/h3js/srvx/tree/main/examples/tracing/",[258],"examples/tracing",[452,812,813],{},[84,814,815],{},"npx giget gh:h3js/srvx/examples/tracing srvx-tracing",[437,817,818,823,830],{},[452,819,820],{},[84,821,822],{},"websocket",[452,824,825],{},[254,826,829],{"href":827,"rel":828},"https://github.com/h3js/srvx/tree/main/examples/websocket/",[258],"examples/websocket",[452,831,832],{},[84,833,834],{},"npx giget gh:h3js/srvx/examples/websocket srvx-websocket",[836,837,838],"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}",{"title":82,"searchDepth":104,"depth":104,"links":840},[841,842,843,844],{"id":69,"depth":104,"text":70},{"id":262,"depth":104,"text":263},{"id":421,"depth":104,"text":422},{"id":569,"depth":104,"text":570},"Build HTTP servers with web standard APIs like fetch, Request, and Response.","md",{"automd":303,"icon":10},{"icon":10},{"title":5,"description":845},"kyehuhTquehJLDda8c3VdBG6gdCJCd2CUces29kksbw",[852,853],null,{"title":12,"path":13,"stem":14,"description":854,"icon":15,"children":-1},"Get familiar with srvx fetch server handler and ServerRequest.",1785329751859]