[{"data":1,"prerenderedAt":987},["ShallowReactive",2],{"navigation":3,"-guide":61,"-guide-surround":983},[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":977,"extension":978,"meta":979,"navigation":980,"path":6,"seo":981,"stem":7,"__hash__":982},"content/1.guide/01.index.md",{"type":64,"value":65,"toc":971,"icon":10},"minimark",[66,71,75,159,162,243,247,260,264,275,277,358,364,367,369,419,423,438,460,535,541,562,693,697,967],[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,430,433,434,437],{},"srvx ships self-contained types: they reference no runtime type packages, so ",[84,427,428],{},"tsc"," passes with only ",[84,431,432],{},"@types/node"," (or none at all) and without ",[84,435,436],{},"skipLibCheck",", whichever runtime you target.",[72,439,440,441,444,445,444,448,451,452,455,456,459],{},"Runtime objects such as ",[84,442,443],{},"server.bun?.server",", ",[84,446,447],{},"server.deno?.server",[84,449,450],{},"request.runtime?.cloudflare?.context"," or ",[84,453,454],{},"request.runtime?.awsLambda?.event"," are described by minimal interfaces covering what srvx itself uses. They accept the official types, so passing a real ",[84,457,458],{},"Bun.Server"," or Lambda event still type checks. To reach the full surface of a runtime object, install that runtime's type package and cast:",[76,461,465],{"className":462,"code":463,"language":464,"meta":82,"style":82},"language-ts shiki shiki-themes github-light github-dark github-dark","import type { Server } from \"bun\";\n\nconst bunServer = server.bun?.server as Server | undefined;\nbunServer?.publish(\"channel\", \"hello\");\n","ts",[84,466,467,484,488,514],{"__ignoreMap":82},[87,468,469,471,474,477,479,482],{"class":89,"line":90},[87,470,286],{"class":93},[87,472,473],{"class":93}," type",[87,475,476],{"class":100}," { Server } ",[87,478,292],{"class":93},[87,480,481],{"class":142}," \"bun\"",[87,483,298],{"class":100},[87,485,486],{"class":89,"line":104},[87,487,304],{"emptyLinePlaceholder":303},[87,489,490,492,495,497,500,503,506,509,512],{"class":89,"line":127},[87,491,309],{"class":93},[87,493,494],{"class":222}," bunServer",[87,496,315],{"class":93},[87,498,499],{"class":100}," server.bun?.server ",[87,501,502],{"class":93},"as",[87,504,505],{"class":107}," Server",[87,507,508],{"class":93}," |",[87,510,511],{"class":222}," undefined",[87,513,298],{"class":100},[87,515,516,519,522,524,527,529,532],{"class":89,"line":149},[87,517,518],{"class":100},"bunServer?.",[87,520,521],{"class":107},"publish",[87,523,111],{"class":100},[87,525,526],{"class":142},"\"channel\"",[87,528,444],{"class":100},[87,530,531],{"class":142},"\"hello\"",[87,533,534],{"class":100},");\n",[72,536,537,538,118],{},"To type Cloudflare Workers bindings, augment ",[84,539,540],{},"CloudflareEnv",[72,542,543,544,547,548,550,551,554,555,557,558,561],{},"The ",[84,545,546],{},"declare module"," block only augments ",[84,549,540],{}," in a file that is a module. In a standalone ",[84,552,553],{},".d.ts"," with no imports or exports it would declare a whole new ",[84,556,269],{}," module instead, so add ",[84,559,560],{},"export {}"," there.",[76,563,565],{"className":462,"code":564,"language":464,"meta":82,"style":82},"import { serve } from \"srvx\";\n\ndeclare module \"srvx\" {\n  interface CloudflareEnv {\n    MY_KV: KVNamespace;\n  }\n}\n\nserve({\n  fetch: (request) => {\n    const kv = request.runtime?.cloudflare?.env.MY_KV;\n    // ...\n  },\n});\n",[84,566,567,579,583,595,605,617,622,627,632,639,657,676,683,688],{"__ignoreMap":82},[87,568,569,571,573,575,577],{"class":89,"line":90},[87,570,286],{"class":93},[87,572,289],{"class":100},[87,574,292],{"class":93},[87,576,295],{"class":142},[87,578,298],{"class":100},[87,580,581],{"class":89,"line":104},[87,582,304],{"emptyLinePlaceholder":303},[87,584,585,588,591,593],{"class":89,"line":127},[87,586,587],{"class":93},"declare",[87,589,590],{"class":93}," module",[87,592,295],{"class":142},[87,594,101],{"class":100},[87,596,597,600,603],{"class":89,"line":149},[87,598,599],{"class":93},"  interface",[87,601,602],{"class":107}," CloudflareEnv",[87,604,101],{"class":100},[87,606,607,610,612,615],{"class":89,"line":155},[87,608,609],{"class":114},"    MY_KV",[87,611,118],{"class":93},[87,613,614],{"class":107}," KVNamespace",[87,616,298],{"class":100},[87,618,619],{"class":89,"line":349},[87,620,621],{"class":100},"  }\n",[87,623,624],{"class":89,"line":354},[87,625,626],{"class":100},"}\n",[87,628,630],{"class":89,"line":629},8,[87,631,304],{"emptyLinePlaceholder":303},[87,633,635,637],{"class":89,"line":634},9,[87,636,273],{"class":107},[87,638,321],{"class":100},[87,640,642,644,647,649,652,655],{"class":89,"line":641},10,[87,643,108],{"class":107},[87,645,646],{"class":100},": (",[87,648,330],{"class":114},[87,650,651],{"class":100},") ",[87,653,654],{"class":93},"=>",[87,656,101],{"class":100},[87,658,660,663,666,668,671,674],{"class":89,"line":659},11,[87,661,662],{"class":93},"    const",[87,664,665],{"class":222}," kv",[87,667,315],{"class":93},[87,669,670],{"class":100}," request.runtime?.cloudflare?.env.",[87,672,673],{"class":222},"MY_KV",[87,675,298],{"class":100},[87,677,679],{"class":89,"line":678},12,[87,680,682],{"class":681},"sCsY4","    // ...\n",[87,684,686],{"class":89,"line":685},13,[87,687,152],{"class":100},[87,689,691],{"class":89,"line":690},14,[87,692,357],{"class":100},[67,694,696],{"id":695},"starter-examples","Starter Examples",[698,699,700,716],"table",{},[701,702,703],"thead",{},[704,705,706,710,713],"tr",{},[707,708,709],"th",{},"Example",[707,711,712],{},"Source",[707,714,715],{},"Try",[717,718,719,739,758,777,796,815,834,853,872,891,910,929,948],"tbody",{},[704,720,721,727,734],{},[722,723,724],"td",{},[84,725,726],{},"aws-lambda",[722,728,729],{},[254,730,733],{"href":731,"rel":732},"https://github.com/h3js/srvx/tree/main/examples/aws-lambda/",[258],"examples/aws-lambda",[722,735,736],{},[84,737,738],{},"npx giget gh:h3js/srvx/examples/aws-lambda srvx-aws-lambda",[704,740,741,746,753],{},[722,742,743],{},[84,744,745],{},"elysia",[722,747,748],{},[254,749,752],{"href":750,"rel":751},"https://github.com/h3js/srvx/tree/main/examples/elysia/",[258],"examples/elysia",[722,754,755],{},[84,756,757],{},"npx giget gh:h3js/srvx/examples/elysia srvx-elysia",[704,759,760,765,772],{},[722,761,762],{},[84,763,764],{},"express",[722,766,767],{},[254,768,771],{"href":769,"rel":770},"https://github.com/h3js/srvx/tree/main/examples/express/",[258],"examples/express",[722,773,774],{},[84,775,776],{},"npx giget gh:h3js/srvx/examples/express srvx-express",[704,778,779,784,791],{},[722,780,781],{},[84,782,783],{},"fastify",[722,785,786],{},[254,787,790],{"href":788,"rel":789},"https://github.com/h3js/srvx/tree/main/examples/fastify/",[258],"examples/fastify",[722,792,793],{},[84,794,795],{},"npx giget gh:h3js/srvx/examples/fastify srvx-fastify",[704,797,798,803,810],{},[722,799,800],{},[84,801,802],{},"h3",[722,804,805],{},[254,806,809],{"href":807,"rel":808},"https://github.com/h3js/srvx/tree/main/examples/h3/",[258],"examples/h3",[722,811,812],{},[84,813,814],{},"npx giget gh:h3js/srvx/examples/h3 srvx-h3",[704,816,817,822,829],{},[722,818,819],{},[84,820,821],{},"hello-world",[722,823,824],{},[254,825,828],{"href":826,"rel":827},"https://github.com/h3js/srvx/tree/main/examples/hello-world/",[258],"examples/hello-world",[722,830,831],{},[84,832,833],{},"npx giget gh:h3js/srvx/examples/hello-world srvx-hello-world",[704,835,836,841,848],{},[722,837,838],{},[84,839,840],{},"hono",[722,842,843],{},[254,844,847],{"href":845,"rel":846},"https://github.com/h3js/srvx/tree/main/examples/hono/",[258],"examples/hono",[722,849,850],{},[84,851,852],{},"npx giget gh:h3js/srvx/examples/hono srvx-hono",[704,854,855,860,867],{},[722,856,857],{},[84,858,859],{},"jsx",[722,861,862],{},[254,863,866],{"href":864,"rel":865},"https://github.com/h3js/srvx/tree/main/examples/jsx/",[258],"examples/jsx",[722,868,869],{},[84,870,871],{},"npx giget gh:h3js/srvx/examples/jsx srvx-jsx",[704,873,874,879,886],{},[722,875,876],{},[84,877,878],{},"node-handler",[722,880,881],{},[254,882,885],{"href":883,"rel":884},"https://github.com/h3js/srvx/tree/main/examples/node-handler/",[258],"examples/node-handler",[722,887,888],{},[84,889,890],{},"npx giget gh:h3js/srvx/examples/node-handler srvx-node-handler",[704,892,893,898,905],{},[722,894,895],{},[84,896,897],{},"service-worker",[722,899,900],{},[254,901,904],{"href":902,"rel":903},"https://github.com/h3js/srvx/tree/main/examples/service-worker/",[258],"examples/service-worker",[722,906,907],{},[84,908,909],{},"npx giget gh:h3js/srvx/examples/service-worker srvx-service-worker",[704,911,912,917,924],{},[722,913,914],{},[84,915,916],{},"streaming",[722,918,919],{},[254,920,923],{"href":921,"rel":922},"https://github.com/h3js/srvx/tree/main/examples/streaming/",[258],"examples/streaming",[722,925,926],{},[84,927,928],{},"npx giget gh:h3js/srvx/examples/streaming srvx-streaming",[704,930,931,936,943],{},[722,932,933],{},[84,934,935],{},"tracing",[722,937,938],{},[254,939,942],{"href":940,"rel":941},"https://github.com/h3js/srvx/tree/main/examples/tracing/",[258],"examples/tracing",[722,944,945],{},[84,946,947],{},"npx giget gh:h3js/srvx/examples/tracing srvx-tracing",[704,949,950,955,962],{},[722,951,952],{},[84,953,954],{},"websocket",[722,956,957],{},[254,958,961],{"href":959,"rel":960},"https://github.com/h3js/srvx/tree/main/examples/websocket/",[258],"examples/websocket",[722,963,964],{},[84,965,966],{},"npx giget gh:h3js/srvx/examples/websocket srvx-websocket",[968,969,970],"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":972},[973,974,975,976],{"id":69,"depth":104,"text":70},{"id":262,"depth":104,"text":263},{"id":421,"depth":104,"text":422},{"id":695,"depth":104,"text":696},"Build HTTP servers with web standard APIs like fetch, Request, and Response.","md",{"automd":303,"icon":10},{"icon":10},{"title":5,"description":977},"ghbgp2mbKfGZudXtQxetQeqA2RZDAbSEtUmhL0yMWvc",[984,985],null,{"title":12,"path":13,"stem":14,"description":986,"icon":15,"children":-1},"Get familiar with srvx fetch server handler and ServerRequest.",1785341918580]