[{"data":1,"prerenderedAt":2500},["ShallowReactive",2],{"navigation":3,"-guide-cli":56,"-guide-cli-surround":2495},[4],{"title":5,"path":6,"stem":7,"children":8,"icon":10},"Getting Started","/guide","1.guide/1.index",[9,11,16,21,26,31,36,41,46,51],{"title":5,"path":6,"stem":7,"icon":10},"ph:book-open-duotone",{"title":12,"path":13,"stem":14,"icon":15},"Using CLI","/guide/cli","1.guide/10.cli","garden:terminal-cli-stroke-12",{"title":17,"path":18,"stem":19,"icon":20},"Fetch Handler","/guide/handler","1.guide/2.handler","i-fluent:target-24-regular",{"title":22,"path":23,"stem":24,"icon":25},"Server Instance","/guide/server","1.guide/3.server","radix-icons:component-instance",{"title":27,"path":28,"stem":29,"icon":30},"Middleware","/guide/middleware","1.guide/4.middleware","clarity:plugin-line",{"title":32,"path":33,"stem":34,"icon":35},"Server Options","/guide/options","1.guide/5.options","ri:settings-3-line",{"title":37,"path":38,"stem":39,"icon":40},"TLS","/guide/tls","1.guide/6.tls","ri:lock-2-line",{"title":42,"path":43,"stem":44,"icon":45},"Bundler Usage","/guide/bundler","1.guide/7.bundler","clarity:bundle-line",{"title":47,"path":48,"stem":49,"icon":50},"Node.js Support","/guide/node","1.guide/8.node","akar-icons:node-fill",{"title":52,"path":53,"stem":54,"icon":55},"AWS Lambda","/guide/aws-lambda","1.guide/9.aws-lambda","clarity:cloud-traffic-line",{"id":57,"title":12,"body":58,"description":2489,"extension":2490,"meta":2491,"navigation":2492,"path":13,"seo":2493,"stem":14,"__hash__":2494},"content/1.guide/10.cli.md",{"type":59,"value":60,"toc":2473,"icon":15},"minimark",[61,70,158,163,1358,1362,1365,1409,1413,1435,1439,1463,1467,1474,1490,1503,1506,1525,1558,1596,1600,1607,1760,1774,1779,1794,1816,1838,1859,1863,1866,1904,1926,1929,1935,1951,2060,2071,2082,2096,2105,2109,2132,2135,2221,2226,2235,2241,2342,2348,2419,2423,2429,2469],[62,63,64,65,69],"p",{},"You can run ",[66,67,68],"code",{},"srvx"," with your preferred runtime without installation:",[71,72,73,96,109,124,142],"CodeGroup",{},[74,75,81],"pre",{"className":76,"code":77,"filename":78,"language":79,"meta":80,"style":80},"language-bash shiki shiki-themes github-light github-dark github-dark","npx srvx\n","npm","bash","",[66,82,83],{"__ignoreMap":80},[84,85,88,92],"span",{"class":86,"line":87},"line",1,[84,89,91],{"class":90},"shcOC","npx",[84,93,95],{"class":94},"sfrk1"," srvx\n",[74,97,100],{"className":76,"code":98,"filename":99,"language":79,"meta":80,"style":80},"pnpx srvx\n","pnpm",[66,101,102],{"__ignoreMap":80},[84,103,104,107],{"class":86,"line":87},[84,105,106],{"class":90},"pnpx",[84,108,95],{"class":94},[74,110,113],{"className":76,"code":111,"filename":112,"language":79,"meta":80,"style":80},"yarn dlx srvx\n","yarn",[66,114,115],{"__ignoreMap":80},[84,116,117,119,122],{"class":86,"line":87},[84,118,112],{"class":90},[84,120,121],{"class":94}," dlx",[84,123,95],{"class":94},[74,125,128],{"className":76,"code":126,"filename":127,"language":79,"meta":80,"style":80},"deno -A npm:srvx\n","Deno",[66,129,130],{"__ignoreMap":80},[84,131,132,135,139],{"class":86,"line":87},[84,133,134],{"class":90},"deno",[84,136,138],{"class":137},"suiK_"," -A",[84,140,141],{"class":94}," npm:srvx\n",[74,143,146],{"className":76,"code":144,"filename":145,"language":79,"meta":80,"style":80},"bunx --bun srvx\n","Bun",[66,147,148],{"__ignoreMap":80},[84,149,150,153,156],{"class":86,"line":87},[84,151,152],{"class":90},"bunx",[84,154,155],{"class":137}," --bun",[84,157,95],{"class":94},[159,160,162],"h2",{"id":161},"usage","Usage",[74,164,168],{"className":165,"code":166,"language":167,"meta":80,"style":80},"language-sh shiki shiki-themes github-light github-dark github-dark","srvx   - Universal Server.\n\nSERVE MODE\n\n# srvx serve [options]\n$ srvx serve --entry ./server.ts    # Start development server\n$ srvx serve --prod                 # Start production  server\n$ srvx serve --port=8080            # Listen on port 8080\n$ srvx serve --host=localhost       # Bind to localhost only\n$ srvx serve --static=./dist        # Serve static files (no entry needed)\n$ srvx serve --static=./dist --no-dir-listing # ...without the dev directory listing\n$ srvx serve --prod --dir-listing   # Enable the directory listing in production\n$ srvx serve --import=jiti/register # Enable [jiti](https://github.com/unjs/jiti) loader\n$ srvx serve --tls --cert=cert.pem --key=key.pem  # Enable TLS (HTTPS/HTTP2)\n\nFETCH MODE\n\n# srvx fetch|curl [options] [url]\n$ srvx fetch                  # Fetch from default entry\n$ srvx fetch /api/users       # Fetch a specific URL/path\n$ srvx fetch --entry ./server.ts /api/users # Fetch using a specific entry\n$ srvx fetch -X POST /api/users # POST request\n$ srvx fetch -H \"Content-Type: application/json\" /api # With headers\n$ srvx fetch -d '{\"name\":\"foo\"}' /api # With request body\n$ srvx fetch -v /api/users    # Verbose output (show headers)\n$ echo '{\"name\":\"foo\"}' | srvx fetch -d @- /api # Body from stdin\n\nCOMMON OPTIONS\n\n  --entry \u003Cfile>            Server entry file to use\n  --dir \u003Cdir>               Working directory for resolving entry file\n  -h, --help                Show this help message\n  --version                 Show server and runtime versions\n\nSERVE OPTIONS\n\n  -p, --port \u003Cport>         Port to listen on (default: 3000)\n  --host, --hostname \u003Chost> Host to bind to (default: all interfaces)\n  -s, --static \u003Cdir>        Serve static files from the specified directory (default: public)\n  --dir-listing             Serve a directory listing for index-less directories (default: on in dev, off with --prod)\n  --no-dir-listing          Disable the directory listing (e.g. in dev)\n  --prod                    Run in production mode (no watch, no debug)\n  --import \u003Cloader>         ES module to preload\n  --tls                     Enable TLS (HTTPS/HTTP2)\n  --cert \u003Cfile>             TLS certificate file\n  --key  \u003Cfile>             TLS private key file\n\nFETCH OPTIONS\n\n  -X, --method \u003Cmethod>     HTTP method (default: GET, or POST if body is provided; --request is a curl alias)\n  -H, --header \u003Cheader>     Add header (format: \"Name: Value\", can be used multiple times)\n  -d, --data \u003Cdata>         Request body (use @- for stdin, @file for file)\n  --host \u003Chost>             Host for a schemeless URL/path (default: localhost)\n  --tls                     Use https for a schemeless URL/path\n  -v, --verbose             Show request and response headers\n\n  Exits with code 22 on a non-2xx response (like curl --fail).\n\nENVIRONMENT\n\n  PORT                      Default port to listen on\n  HOST                      Default host to bind to\n  NODE_ENV                  Set to production for production mode.\n","sh",[66,169,170,183,190,199,204,211,232,247,262,277,292,309,326,341,362,367,375,380,386,399,414,432,452,473,493,510,538,543,552,557,591,624,645,666,671,678,683,722,760,804,850,876,907,933,948,970,995,1000,1007,1012,1077,1124,1168,1202,1222,1245,1250,1285,1290,1296,1301,1320,1338],{"__ignoreMap":80},[84,171,172,174,177,180],{"class":86,"line":87},[84,173,68],{"class":90},[84,175,176],{"class":94},"   -",[84,178,179],{"class":94}," Universal",[84,181,182],{"class":94}," Server.\n",[84,184,186],{"class":86,"line":185},2,[84,187,189],{"emptyLinePlaceholder":188},true,"\n",[84,191,193,196],{"class":86,"line":192},3,[84,194,195],{"class":90},"SERVE",[84,197,198],{"class":94}," MODE\n",[84,200,202],{"class":86,"line":201},4,[84,203,189],{"emptyLinePlaceholder":188},[84,205,207],{"class":86,"line":206},5,[84,208,210],{"class":209},"sCsY4","# srvx serve [options]\n",[84,212,214,217,220,223,226,229],{"class":86,"line":213},6,[84,215,216],{"class":90},"$",[84,218,219],{"class":94}," srvx",[84,221,222],{"class":94}," serve",[84,224,225],{"class":137}," --entry",[84,227,228],{"class":94}," ./server.ts",[84,230,231],{"class":209},"    # Start development server\n",[84,233,235,237,239,241,244],{"class":86,"line":234},7,[84,236,216],{"class":90},[84,238,219],{"class":94},[84,240,222],{"class":94},[84,242,243],{"class":137}," --prod",[84,245,246],{"class":209},"                 # Start production  server\n",[84,248,250,252,254,256,259],{"class":86,"line":249},8,[84,251,216],{"class":90},[84,253,219],{"class":94},[84,255,222],{"class":94},[84,257,258],{"class":137}," --port=8080",[84,260,261],{"class":209},"            # Listen on port 8080\n",[84,263,265,267,269,271,274],{"class":86,"line":264},9,[84,266,216],{"class":90},[84,268,219],{"class":94},[84,270,222],{"class":94},[84,272,273],{"class":137}," --host=localhost",[84,275,276],{"class":209},"       # Bind to localhost only\n",[84,278,280,282,284,286,289],{"class":86,"line":279},10,[84,281,216],{"class":90},[84,283,219],{"class":94},[84,285,222],{"class":94},[84,287,288],{"class":137}," --static=./dist",[84,290,291],{"class":209},"        # Serve static files (no entry needed)\n",[84,293,295,297,299,301,303,306],{"class":86,"line":294},11,[84,296,216],{"class":90},[84,298,219],{"class":94},[84,300,222],{"class":94},[84,302,288],{"class":137},[84,304,305],{"class":137}," --no-dir-listing",[84,307,308],{"class":209}," # ...without the dev directory listing\n",[84,310,312,314,316,318,320,323],{"class":86,"line":311},12,[84,313,216],{"class":90},[84,315,219],{"class":94},[84,317,222],{"class":94},[84,319,243],{"class":137},[84,321,322],{"class":137}," --dir-listing",[84,324,325],{"class":209},"   # Enable the directory listing in production\n",[84,327,329,331,333,335,338],{"class":86,"line":328},13,[84,330,216],{"class":90},[84,332,219],{"class":94},[84,334,222],{"class":94},[84,336,337],{"class":137}," --import=jiti/register",[84,339,340],{"class":209}," # Enable [jiti](https://github.com/unjs/jiti) loader\n",[84,342,344,346,348,350,353,356,359],{"class":86,"line":343},14,[84,345,216],{"class":90},[84,347,219],{"class":94},[84,349,222],{"class":94},[84,351,352],{"class":137}," --tls",[84,354,355],{"class":137}," --cert=cert.pem",[84,357,358],{"class":137}," --key=key.pem",[84,360,361],{"class":209},"  # Enable TLS (HTTPS/HTTP2)\n",[84,363,365],{"class":86,"line":364},15,[84,366,189],{"emptyLinePlaceholder":188},[84,368,370,373],{"class":86,"line":369},16,[84,371,372],{"class":90},"FETCH",[84,374,198],{"class":94},[84,376,378],{"class":86,"line":377},17,[84,379,189],{"emptyLinePlaceholder":188},[84,381,383],{"class":86,"line":382},18,[84,384,385],{"class":209},"# srvx fetch|curl [options] [url]\n",[84,387,389,391,393,396],{"class":86,"line":388},19,[84,390,216],{"class":90},[84,392,219],{"class":94},[84,394,395],{"class":94}," fetch",[84,397,398],{"class":209},"                  # Fetch from default entry\n",[84,400,402,404,406,408,411],{"class":86,"line":401},20,[84,403,216],{"class":90},[84,405,219],{"class":94},[84,407,395],{"class":94},[84,409,410],{"class":94}," /api/users",[84,412,413],{"class":209},"       # Fetch a specific URL/path\n",[84,415,417,419,421,423,425,427,429],{"class":86,"line":416},21,[84,418,216],{"class":90},[84,420,219],{"class":94},[84,422,395],{"class":94},[84,424,225],{"class":137},[84,426,228],{"class":94},[84,428,410],{"class":94},[84,430,431],{"class":209}," # Fetch using a specific entry\n",[84,433,435,437,439,441,444,447,449],{"class":86,"line":434},22,[84,436,216],{"class":90},[84,438,219],{"class":94},[84,440,395],{"class":94},[84,442,443],{"class":137}," -X",[84,445,446],{"class":94}," POST",[84,448,410],{"class":94},[84,450,451],{"class":209}," # POST request\n",[84,453,455,457,459,461,464,467,470],{"class":86,"line":454},23,[84,456,216],{"class":90},[84,458,219],{"class":94},[84,460,395],{"class":94},[84,462,463],{"class":137}," -H",[84,465,466],{"class":94}," \"Content-Type: application/json\"",[84,468,469],{"class":94}," /api",[84,471,472],{"class":209}," # With headers\n",[84,474,476,478,480,482,485,488,490],{"class":86,"line":475},24,[84,477,216],{"class":90},[84,479,219],{"class":94},[84,481,395],{"class":94},[84,483,484],{"class":137}," -d",[84,486,487],{"class":94}," '{\"name\":\"foo\"}'",[84,489,469],{"class":94},[84,491,492],{"class":209}," # With request body\n",[84,494,496,498,500,502,505,507],{"class":86,"line":495},25,[84,497,216],{"class":90},[84,499,219],{"class":94},[84,501,395],{"class":94},[84,503,504],{"class":137}," -v",[84,506,410],{"class":94},[84,508,509],{"class":209},"    # Verbose output (show headers)\n",[84,511,513,515,518,520,524,526,528,530,533,535],{"class":86,"line":512},26,[84,514,216],{"class":90},[84,516,517],{"class":94}," echo",[84,519,487],{"class":94},[84,521,523],{"class":522},"so5gQ"," |",[84,525,219],{"class":90},[84,527,395],{"class":94},[84,529,484],{"class":137},[84,531,532],{"class":94}," @-",[84,534,469],{"class":94},[84,536,537],{"class":209}," # Body from stdin\n",[84,539,541],{"class":86,"line":540},27,[84,542,189],{"emptyLinePlaceholder":188},[84,544,546,549],{"class":86,"line":545},28,[84,547,548],{"class":90},"COMMON",[84,550,551],{"class":94}," OPTIONS\n",[84,553,555],{"class":86,"line":554},29,[84,556,189],{"emptyLinePlaceholder":188},[84,558,560,563,566,569,573,576,579,582,585,588],{"class":86,"line":559},30,[84,561,562],{"class":90},"  --entry",[84,564,565],{"class":522}," \u003C",[84,567,568],{"class":94},"fil",[84,570,572],{"class":571},"slsVL","e",[84,574,575],{"class":522},">",[84,577,578],{"class":94},"            Server",[84,580,581],{"class":94}," entry",[84,583,584],{"class":94}," file",[84,586,587],{"class":94}," to",[84,589,590],{"class":94}," use\n",[84,592,594,597,599,602,605,607,610,613,616,619,621],{"class":86,"line":593},31,[84,595,596],{"class":90},"  --dir",[84,598,565],{"class":522},[84,600,601],{"class":94},"di",[84,603,604],{"class":571},"r",[84,606,575],{"class":522},[84,608,609],{"class":94},"               Working",[84,611,612],{"class":94}," directory",[84,614,615],{"class":94}," for",[84,617,618],{"class":94}," resolving",[84,620,581],{"class":94},[84,622,623],{"class":94}," file\n",[84,625,627,630,633,636,639,642],{"class":86,"line":626},32,[84,628,629],{"class":90},"  -h,",[84,631,632],{"class":137}," --help",[84,634,635],{"class":94},"                Show",[84,637,638],{"class":94}," this",[84,640,641],{"class":94}," help",[84,643,644],{"class":94}," message\n",[84,646,648,651,654,657,660,663],{"class":86,"line":647},33,[84,649,650],{"class":90},"  --version",[84,652,653],{"class":94},"                 Show",[84,655,656],{"class":94}," server",[84,658,659],{"class":94}," and",[84,661,662],{"class":94}," runtime",[84,664,665],{"class":94}," versions\n",[84,667,669],{"class":86,"line":668},34,[84,670,189],{"emptyLinePlaceholder":188},[84,672,674,676],{"class":86,"line":673},35,[84,675,195],{"class":90},[84,677,551],{"class":94},[84,679,681],{"class":86,"line":680},36,[84,682,189],{"emptyLinePlaceholder":188},[84,684,686,689,692,694,697,700,702,705,707,710,713,716,719],{"class":86,"line":685},37,[84,687,688],{"class":90},"  -p,",[84,690,691],{"class":137}," --port",[84,693,565],{"class":522},[84,695,696],{"class":94},"por",[84,698,699],{"class":571},"t",[84,701,575],{"class":522},[84,703,704],{"class":94},"         Port",[84,706,587],{"class":94},[84,708,709],{"class":94}," listen",[84,711,712],{"class":94}," on",[84,714,715],{"class":571}," (default: ",[84,717,718],{"class":137},"3000",[84,720,721],{"class":571},")\n",[84,723,725,728,731,733,736,738,740,743,745,748,750,752,755,758],{"class":86,"line":724},38,[84,726,727],{"class":90},"  --host,",[84,729,730],{"class":137}," --hostname",[84,732,565],{"class":522},[84,734,735],{"class":94},"hos",[84,737,699],{"class":571},[84,739,575],{"class":522},[84,741,742],{"class":94}," Host",[84,744,587],{"class":94},[84,746,747],{"class":94}," bind",[84,749,587],{"class":94},[84,751,715],{"class":571},[84,753,754],{"class":94},"all",[84,756,757],{"class":94}," interfaces",[84,759,721],{"class":571},[84,761,763,766,769,771,773,775,777,780,783,786,789,792,795,797,799,802],{"class":86,"line":762},39,[84,764,765],{"class":90},"  -s,",[84,767,768],{"class":137}," --static",[84,770,565],{"class":522},[84,772,601],{"class":94},[84,774,604],{"class":571},[84,776,575],{"class":522},[84,778,779],{"class":94},"        Serve",[84,781,782],{"class":94}," static",[84,784,785],{"class":94}," files",[84,787,788],{"class":94}," from",[84,790,791],{"class":94}," the",[84,793,794],{"class":94}," specified",[84,796,612],{"class":94},[84,798,715],{"class":571},[84,800,801],{"class":94},"public",[84,803,721],{"class":571},[84,805,807,810,813,816,818,821,823,826,829,831,834,837,840,843,846,848],{"class":86,"line":806},40,[84,808,809],{"class":90},"  --dir-listing",[84,811,812],{"class":94},"             Serve",[84,814,815],{"class":94}," a",[84,817,612],{"class":94},[84,819,820],{"class":94}," listing",[84,822,615],{"class":94},[84,824,825],{"class":94}," index-less",[84,827,828],{"class":94}," directories",[84,830,715],{"class":571},[84,832,833],{"class":94},"on",[84,835,836],{"class":94}," in",[84,838,839],{"class":94}," dev,",[84,841,842],{"class":94}," off",[84,844,845],{"class":94}," with",[84,847,243],{"class":137},[84,849,721],{"class":571},[84,851,853,856,859,861,863,865,868,871,874],{"class":86,"line":852},41,[84,854,855],{"class":90},"  --no-dir-listing",[84,857,858],{"class":94},"          Disable",[84,860,791],{"class":94},[84,862,612],{"class":94},[84,864,820],{"class":94},[84,866,867],{"class":571}," (e.g. ",[84,869,870],{"class":94},"in",[84,872,873],{"class":94}," dev",[84,875,721],{"class":571},[84,877,879,882,885,887,890,893,896,899,902,905],{"class":86,"line":878},42,[84,880,881],{"class":90},"  --prod",[84,883,884],{"class":94},"                    Run",[84,886,836],{"class":94},[84,888,889],{"class":94}," production",[84,891,892],{"class":94}," mode",[84,894,895],{"class":571}," (no ",[84,897,898],{"class":94},"watch,",[84,900,901],{"class":94}," no",[84,903,904],{"class":94}," debug",[84,906,721],{"class":571},[84,908,910,913,915,918,920,922,925,928,930],{"class":86,"line":909},43,[84,911,912],{"class":90},"  --import",[84,914,565],{"class":522},[84,916,917],{"class":94},"loade",[84,919,604],{"class":571},[84,921,575],{"class":522},[84,923,924],{"class":94},"         ES",[84,926,927],{"class":94}," module",[84,929,587],{"class":94},[84,931,932],{"class":94}," preload\n",[84,934,936,939,942,945],{"class":86,"line":935},44,[84,937,938],{"class":90},"  --tls",[84,940,941],{"class":94},"                     Enable",[84,943,944],{"class":94}," TLS",[84,946,947],{"class":571}," (HTTPS/HTTP2)\n",[84,949,951,954,956,958,960,962,965,968],{"class":86,"line":950},45,[84,952,953],{"class":90},"  --cert",[84,955,565],{"class":522},[84,957,568],{"class":94},[84,959,572],{"class":571},[84,961,575],{"class":522},[84,963,964],{"class":94},"             TLS",[84,966,967],{"class":94}," certificate",[84,969,623],{"class":94},[84,971,973,976,979,981,983,985,987,990,993],{"class":86,"line":972},46,[84,974,975],{"class":90},"  --key",[84,977,978],{"class":522},"  \u003C",[84,980,568],{"class":94},[84,982,572],{"class":571},[84,984,575],{"class":522},[84,986,964],{"class":94},[84,988,989],{"class":94}," private",[84,991,992],{"class":94}," key",[84,994,623],{"class":94},[84,996,998],{"class":86,"line":997},47,[84,999,189],{"emptyLinePlaceholder":188},[84,1001,1003,1005],{"class":86,"line":1002},48,[84,1004,372],{"class":90},[84,1006,551],{"class":94},[84,1008,1010],{"class":86,"line":1009},49,[84,1011,189],{"emptyLinePlaceholder":188},[84,1013,1015,1018,1021,1023,1026,1029,1031,1034,1037,1039,1042,1045,1047,1050,1053,1056,1059,1062,1065,1067,1069,1072,1075],{"class":86,"line":1014},50,[84,1016,1017],{"class":90},"  -X,",[84,1019,1020],{"class":137}," --method",[84,1022,565],{"class":522},[84,1024,1025],{"class":94},"metho",[84,1027,1028],{"class":571},"d",[84,1030,575],{"class":522},[84,1032,1033],{"class":94},"     HTTP",[84,1035,1036],{"class":94}," method",[84,1038,715],{"class":571},[84,1040,1041],{"class":94},"GET,",[84,1043,1044],{"class":94}," or",[84,1046,446],{"class":94},[84,1048,1049],{"class":94}," if",[84,1051,1052],{"class":94}," body",[84,1054,1055],{"class":94}," is",[84,1057,1058],{"class":94}," provided",[84,1060,1061],{"class":571},"; ",[84,1063,1064],{"class":90},"--request",[84,1066,1055],{"class":94},[84,1068,815],{"class":94},[84,1070,1071],{"class":94}," curl",[84,1073,1074],{"class":94}," alias",[84,1076,721],{"class":571},[84,1078,1080,1083,1086,1088,1091,1093,1095,1098,1101,1104,1107,1110,1113,1116,1119,1122],{"class":86,"line":1079},51,[84,1081,1082],{"class":90},"  -H,",[84,1084,1085],{"class":137}," --header",[84,1087,565],{"class":522},[84,1089,1090],{"class":94},"heade",[84,1092,604],{"class":571},[84,1094,575],{"class":522},[84,1096,1097],{"class":94},"     Add",[84,1099,1100],{"class":94}," header",[84,1102,1103],{"class":571}," (format: ",[84,1105,1106],{"class":94},"\"Name: Value\",",[84,1108,1109],{"class":94}," can",[84,1111,1112],{"class":94}," be",[84,1114,1115],{"class":94}," used",[84,1117,1118],{"class":94}," multiple",[84,1120,1121],{"class":94}," times",[84,1123,721],{"class":571},[84,1125,1127,1130,1133,1135,1138,1141,1143,1146,1148,1151,1154,1156,1159,1162,1164,1166],{"class":86,"line":1126},52,[84,1128,1129],{"class":90},"  -d,",[84,1131,1132],{"class":137}," --data",[84,1134,565],{"class":522},[84,1136,1137],{"class":94},"dat",[84,1139,1140],{"class":571},"a",[84,1142,575],{"class":522},[84,1144,1145],{"class":94},"         Request",[84,1147,1052],{"class":94},[84,1149,1150],{"class":571}," (use ",[84,1152,1153],{"class":94},"@-",[84,1155,615],{"class":94},[84,1157,1158],{"class":94}," stdin,",[84,1160,1161],{"class":94}," @file",[84,1163,615],{"class":94},[84,1165,584],{"class":94},[84,1167,721],{"class":571},[84,1169,1171,1174,1176,1178,1180,1182,1185,1187,1189,1192,1195,1197,1200],{"class":86,"line":1170},53,[84,1172,1173],{"class":90},"  --host",[84,1175,565],{"class":522},[84,1177,735],{"class":94},[84,1179,699],{"class":571},[84,1181,575],{"class":522},[84,1183,1184],{"class":94},"             Host",[84,1186,615],{"class":94},[84,1188,815],{"class":94},[84,1190,1191],{"class":94}," schemeless",[84,1193,1194],{"class":94}," URL/path",[84,1196,715],{"class":571},[84,1198,1199],{"class":94},"localhost",[84,1201,721],{"class":571},[84,1203,1205,1207,1210,1213,1215,1217,1219],{"class":86,"line":1204},54,[84,1206,938],{"class":90},[84,1208,1209],{"class":94},"                     Use",[84,1211,1212],{"class":94}," https",[84,1214,615],{"class":94},[84,1216,815],{"class":94},[84,1218,1191],{"class":94},[84,1220,1221],{"class":94}," URL/path\n",[84,1223,1225,1228,1231,1234,1237,1239,1242],{"class":86,"line":1224},55,[84,1226,1227],{"class":90},"  -v,",[84,1229,1230],{"class":137}," --verbose",[84,1232,1233],{"class":94},"             Show",[84,1235,1236],{"class":94}," request",[84,1238,659],{"class":94},[84,1240,1241],{"class":94}," response",[84,1243,1244],{"class":94}," headers\n",[84,1246,1248],{"class":86,"line":1247},56,[84,1249,189],{"emptyLinePlaceholder":188},[84,1251,1253,1256,1258,1261,1264,1266,1268,1271,1273,1276,1279,1282],{"class":86,"line":1252},57,[84,1254,1255],{"class":90},"  Exits",[84,1257,845],{"class":94},[84,1259,1260],{"class":94}," code",[84,1262,1263],{"class":137}," 22",[84,1265,712],{"class":94},[84,1267,815],{"class":94},[84,1269,1270],{"class":94}," non-2xx",[84,1272,1241],{"class":94},[84,1274,1275],{"class":571}," (like ",[84,1277,1278],{"class":94},"curl",[84,1280,1281],{"class":137}," --fail",[84,1283,1284],{"class":571},").\n",[84,1286,1288],{"class":86,"line":1287},58,[84,1289,189],{"emptyLinePlaceholder":188},[84,1291,1293],{"class":86,"line":1292},59,[84,1294,1295],{"class":90},"ENVIRONMENT\n",[84,1297,1299],{"class":86,"line":1298},60,[84,1300,189],{"emptyLinePlaceholder":188},[84,1302,1304,1307,1310,1313,1315,1317],{"class":86,"line":1303},61,[84,1305,1306],{"class":90},"  PORT",[84,1308,1309],{"class":94},"                      Default",[84,1311,1312],{"class":94}," port",[84,1314,587],{"class":94},[84,1316,709],{"class":94},[84,1318,1319],{"class":94}," on\n",[84,1321,1323,1326,1328,1331,1333,1335],{"class":86,"line":1322},62,[84,1324,1325],{"class":90},"  HOST",[84,1327,1309],{"class":94},[84,1329,1330],{"class":94}," host",[84,1332,587],{"class":94},[84,1334,747],{"class":94},[84,1336,1337],{"class":94}," to\n",[84,1339,1341,1344,1347,1349,1351,1353,1355],{"class":86,"line":1340},63,[84,1342,1343],{"class":90},"  NODE_ENV",[84,1345,1346],{"class":94},"                  Set",[84,1348,587],{"class":94},[84,1350,889],{"class":94},[84,1352,615],{"class":94},[84,1354,889],{"class":94},[84,1356,1357],{"class":94}," mode.\n",[159,1359,1361],{"id":1360},"port-and-host-precedence","Port and host precedence",[62,1363,1364],{},"The port and host are resolved with the following precedence (highest first):",[1366,1367,1369,1384,1394,1403],"steps",{"level":1368},"4",[1370,1371,1372,1373,1376,1377,1376,1380,1383],"h4",{},"CLI flag (",[66,1374,1375],{},"--port"," / ",[66,1378,1379],{},"--host",[66,1381,1382],{},"--hostname",")",[1370,1385,1386,1387,1376,1390,1393],{},"Module option (",[66,1388,1389],{},"port",[66,1391,1392],{},"hostname"," exported from your server entry)",[1370,1395,1396,1397,1376,1400,1383],{},"Environment variable (",[66,1398,1399],{},"PORT",[66,1401,1402],{},"HOST",[1370,1404,1405,1406,1408],{},"Default (",[66,1407,718],{}," / all interfaces)",[159,1410,1412],{"id":1411},"exit-codes","Exit codes",[62,1414,1415,1416,1420,1421,1424,1425,1430,1431,1434],{},"In ",[1417,1418,1419],"strong",{},"fetch mode",", ",[66,1422,1423],{},"srvx fetch"," exits with code ",[1417,1426,1427],{},[66,1428,1429],{},"22"," for any non-2xx response, and ",[66,1432,1433],{},"0"," for a 2xx response.",[159,1436,1438],{"id":1437},"runtime-notes","Runtime notes",[1440,1441,1442],"note",{},[62,1443,1444,1445,1448,1449,1452,1453,1456,1457,1459,1460,1462],{},"\nThe ",[66,1446,1447],{},"--import"," flag preloads an ES module (e.g. a loader like ",[66,1450,1451],{},"jiti/register","). It is applied on ",[1417,1454,1455],{},"Node.js and Bun only"," — on ",[1417,1458,127],{}," it is silently ignored, since Deno does not support Node's ",[66,1461,1447],{}," preload flag.",[159,1464,1466],{"id":1465},"serving-static-files","Serving static files",[62,1468,1469,1470,1473],{},"The CLI can serve a directory of static files. No server entry is required — point ",[66,1471,1472],{},"--static"," at any folder:",[74,1475,1477],{"className":76,"code":1476,"language":79,"meta":80,"style":80},"npx srvx --static ./dist\n",[66,1478,1479],{"__ignoreMap":80},[84,1480,1481,1483,1485,1487],{"class":86,"line":87},[84,1482,91],{"class":90},[84,1484,219],{"class":94},[84,1486,768],{"class":137},[84,1488,1489],{"class":94}," ./dist\n",[62,1491,1492,1493,1495,1496,1499,1500,1502],{},"If ",[66,1494,1472],{}," is omitted, srvx serves files from a ",[66,1497,1498],{},"public/"," directory when one exists, and skips static serving when it does not. Passing ",[66,1501,1472],{}," explicitly asserts the directory exists: srvx errors out if it is missing, rather than starting up and serving nothing.",[62,1504,1505],{},"When both a server entry and a static directory are present, static files take priority and unmatched requests fall through to your handler.",[62,1507,1508,1509,1512,1513,1516,1517,1520,1521,1524],{},"Static serving includes automatic ",[66,1510,1511],{},"index.html"," resolution, ",[66,1514,1515],{},".html"," extension fallback (e.g. ",[66,1518,1519],{},"/about"," → ",[66,1522,1523],{},"about.html","), common MIME types, gzip/Brotli compression, and path-traversal protection.",[62,1526,1527,1528,1530,1531,1534,1535,1538,1539,1542,1543,1546,1547,1553,1554,1557],{},"In dev mode, a request for a directory with no index file returns a generated HTML listing of its contents, so you can browse a folder without an ",[66,1529,1511],{},". The listing is a last-resort fallback: static files are tried first, then your server handler runs, and only a ",[66,1532,1533],{},"404"," response falls back to the listing — a real route (or a custom 404 page for a non-directory path) always wins. This is a dev convenience only: it is disabled under ",[66,1536,1537],{},"--prod",", so the directory structure is never exposed in production. Override the default either way with ",[66,1540,1541],{},"--dir-listing"," (force it on, e.g. in production) or ",[66,1544,1545],{},"--no-dir-listing"," (force it off in dev). It maps to the ",[1140,1548,1550],{"href":1549},"/guide/middleware#static-files",[66,1551,1552],{},"dirListing"," option of ",[66,1555,1556],{},"serveStatic()",".",[74,1559,1561],{"className":76,"code":1560,"language":79,"meta":80,"style":80},"npx srvx --static ./dist --prod --dir-listing   # opt in under --prod\nnpx srvx --static ./dist --no-dir-listing        # opt out in dev\n",[66,1562,1563,1581],{"__ignoreMap":80},[84,1564,1565,1567,1569,1571,1574,1576,1578],{"class":86,"line":87},[84,1566,91],{"class":90},[84,1568,219],{"class":94},[84,1570,768],{"class":137},[84,1572,1573],{"class":94}," ./dist",[84,1575,243],{"class":137},[84,1577,322],{"class":137},[84,1579,1580],{"class":209},"   # opt in under --prod\n",[84,1582,1583,1585,1587,1589,1591,1593],{"class":86,"line":185},[84,1584,91],{"class":90},[84,1586,219],{"class":94},[84,1588,768],{"class":137},[84,1590,1573],{"class":94},[84,1592,305],{"class":137},[84,1594,1595],{"class":209},"        # opt out in dev\n",[159,1597,1599],{"id":1598},"programmatic-api","Programmatic API",[62,1601,1602,1603,1606],{},"Both CLI modes are built on ",[66,1604,1605],{},"srvx/loader",". The same loader is available to you, so you can build a dev server, a test harness, or a framework CLI that accepts any server entry srvx accepts — without reimplementing entry discovery or handler detection.",[74,1608,1612],{"className":1609,"code":1610,"language":1611,"meta":80,"style":80},"language-ts shiki shiki-themes github-light github-dark github-dark","import { loadServerEntry } from \"srvx/loader\";\nimport { serve } from \"srvx\";\n\nconst loaded = await loadServerEntry({ entry: \"./server.ts\" });\n\nif (loaded.notFound) {\n  throw new Error(\"No server entry found\");\n}\n\nif (!loaded.fetch) {\n  throw new Error(\"Server entry exports no fetch handler\");\n}\n\nserve({ fetch: loaded.fetch });\n","ts",[66,1613,1614,1631,1645,1649,1675,1679,1687,1707,1712,1716,1729,1744,1748,1752],{"__ignoreMap":80},[84,1615,1616,1619,1622,1625,1628],{"class":86,"line":87},[84,1617,1618],{"class":522},"import",[84,1620,1621],{"class":571}," { loadServerEntry } ",[84,1623,1624],{"class":522},"from",[84,1626,1627],{"class":94}," \"srvx/loader\"",[84,1629,1630],{"class":571},";\n",[84,1632,1633,1635,1638,1640,1643],{"class":86,"line":185},[84,1634,1618],{"class":522},[84,1636,1637],{"class":571}," { serve } ",[84,1639,1624],{"class":522},[84,1641,1642],{"class":94}," \"srvx\"",[84,1644,1630],{"class":571},[84,1646,1647],{"class":86,"line":192},[84,1648,189],{"emptyLinePlaceholder":188},[84,1650,1651,1654,1657,1660,1663,1666,1669,1672],{"class":86,"line":201},[84,1652,1653],{"class":522},"const",[84,1655,1656],{"class":137}," loaded",[84,1658,1659],{"class":522}," =",[84,1661,1662],{"class":522}," await",[84,1664,1665],{"class":90}," loadServerEntry",[84,1667,1668],{"class":571},"({ entry: ",[84,1670,1671],{"class":94},"\"./server.ts\"",[84,1673,1674],{"class":571}," });\n",[84,1676,1677],{"class":86,"line":206},[84,1678,189],{"emptyLinePlaceholder":188},[84,1680,1681,1684],{"class":86,"line":213},[84,1682,1683],{"class":522},"if",[84,1685,1686],{"class":571}," (loaded.notFound) {\n",[84,1688,1689,1692,1695,1698,1701,1704],{"class":86,"line":234},[84,1690,1691],{"class":522},"  throw",[84,1693,1694],{"class":522}," new",[84,1696,1697],{"class":90}," Error",[84,1699,1700],{"class":571},"(",[84,1702,1703],{"class":94},"\"No server entry found\"",[84,1705,1706],{"class":571},");\n",[84,1708,1709],{"class":86,"line":249},[84,1710,1711],{"class":571},"}\n",[84,1713,1714],{"class":86,"line":264},[84,1715,189],{"emptyLinePlaceholder":188},[84,1717,1718,1720,1723,1726],{"class":86,"line":279},[84,1719,1683],{"class":522},[84,1721,1722],{"class":571}," (",[84,1724,1725],{"class":522},"!",[84,1727,1728],{"class":571},"loaded.fetch) {\n",[84,1730,1731,1733,1735,1737,1739,1742],{"class":86,"line":294},[84,1732,1691],{"class":522},[84,1734,1694],{"class":522},[84,1736,1697],{"class":90},[84,1738,1700],{"class":571},[84,1740,1741],{"class":94},"\"Server entry exports no fetch handler\"",[84,1743,1706],{"class":571},[84,1745,1746],{"class":86,"line":311},[84,1747,1711],{"class":571},[84,1749,1750],{"class":86,"line":328},[84,1751,189],{"emptyLinePlaceholder":188},[84,1753,1754,1757],{"class":86,"line":343},[84,1755,1756],{"class":90},"serve",[84,1758,1759],{"class":571},"({ fetch: loaded.fetch });\n",[62,1761,1762,1765,1766,1769,1770,1773],{},[66,1763,1764],{},"loadServerEntry(opts)"," imports a server entry module and resolves a web ",[66,1767,1768],{},"fetch"," handler from it. It never throws for a missing entry — check ",[66,1771,1772],{},"notFound"," on the result instead.",[1775,1776,1778],"h3",{"id":1777},"entry-resolution","Entry resolution",[62,1780,1781,1782,1785,1786,1789,1790,1793],{},"When ",[66,1783,1784],{},"entry"," is set, it is resolved against ",[66,1787,1788],{},"dir"," (or the current working directory). A ",[66,1791,1792],{},"file://"," URL is used as-is.",[62,1795,1781,1796,1798,1799,1801,1802,1420,1805,1420,1808,1811,1812,1815],{},[66,1797,1784],{}," is omitted, the loader searches ",[66,1800,1788],{}," for the first match of each of these base names, trying ",[66,1803,1804],{},".mjs",[66,1806,1807],{},".js",[66,1809,1810],{},".mts",", then ",[66,1813,1814],{},".ts"," for each:",[1366,1817,1818,1823,1828,1833],{"level":1368},[1370,1819,1820],{},[66,1821,1822],{},"server",[1370,1824,1825],{},[66,1826,1827],{},"server/index",[1370,1829,1830],{},[66,1831,1832],{},"src/server",[1370,1834,1835],{},[66,1836,1837],{},"server/server",[62,1839,1840,1841,1844,1845,1848,1849,1852,1853,1855,1856,1557],{},"Both lists are exported as ",[66,1842,1843],{},"defaultEntries"," and ",[66,1846,1847],{},"defaultExts"," if you need to reuse them (for example, to build a file watcher). If nothing matches, the result is ",[66,1850,1851],{},"{ notFound: true }"," with no ",[66,1854,1768],{}," and no ",[66,1857,1858],{},"module",[1775,1860,1862],{"id":1861},"handler-resolution","Handler resolution",[62,1864,1865],{},"Once the module is imported, the loader looks for a handler in this order:",[1366,1867,1868,1873,1878,1884,1898],{"level":1368},[1370,1869,1870],{},[66,1871,1872],{},"module.fetch",[1370,1874,1875],{},[66,1876,1877],{},"module.default.fetch",[1370,1879,1880,1883],{},[66,1881,1882],{},"module.default.default.fetch"," (a double-default from a transpiled CommonJS entry)",[1370,1885,1886,1887,1889,1890,1893,1894,1383],{},"The ",[66,1888,1768],{}," of a server the entry created by calling ",[66,1891,1892],{},"serve()"," (see ",[1140,1895,1897],{"href":1896},"#loading-entries-that-start-a-server","Loading entries that start a server",[1370,1899,1900,1903],{},[66,1901,1902],{},"module.default",", if it is a function taking fewer than two arguments",[62,1905,1906,1907,1910,1911,1914,1915,1918,1919,1921,1922,1925],{},"If none match and ",[66,1908,1909],{},"nodeCompat"," is not disabled, a legacy Node.js ",[66,1912,1913],{},"(req, res)"," handler is wrapped into a fetch handler and ",[66,1916,1917],{},"nodeCompat: true"," is set on the result. Both ",[66,1920,1902],{}," and a handler captured from ",[66,1923,1924],{},"http.createServer()"," are eligible.",[1775,1927,1897],{"id":1928},"loading-entries-that-start-a-server",[62,1930,1931,1932,1557],{},"Most server entries do not export a handler — they start listening as a side effect of being imported. The loader intercepts the listen call, so importing the entry gives you its handler ",[1417,1933,1934],{},"without binding a port",[62,1936,1937,1938,1940,1941,1944,1945,1947,1948,1950],{},"If the entry calls srvx's own ",[66,1939,1892],{},", the loader hands you back that server instance as ",[66,1942,1943],{},"srvxServer",", and its handler as ",[66,1946,1768],{},". The server is fully constructed but never listens. Because the entry's ",[66,1949,1892],{}," call runs during the import, the instance does not exist yet when you pass options — use a getter to close the loop:",[74,1952,1954],{"className":1609,"code":1953,"language":1611,"meta":80,"style":80},"let server: Server | undefined;\n\nconst loaded = await loadServerEntry({\n  entry: \"./server.ts\",\n  get srvxServer() {\n    return server;\n  },\n});\n\nserver = serve({ fetch: loaded.fetch!, port: 3000 });\n",[66,1955,1956,1976,1980,1995,2005,2016,2024,2029,2034,2038],{"__ignoreMap":80},[84,1957,1958,1961,1963,1966,1969,1971,1974],{"class":86,"line":87},[84,1959,1960],{"class":522},"let",[84,1962,656],{"class":571},[84,1964,1965],{"class":522},":",[84,1967,1968],{"class":90}," Server",[84,1970,523],{"class":522},[84,1972,1973],{"class":137}," undefined",[84,1975,1630],{"class":571},[84,1977,1978],{"class":86,"line":185},[84,1979,189],{"emptyLinePlaceholder":188},[84,1981,1982,1984,1986,1988,1990,1992],{"class":86,"line":192},[84,1983,1653],{"class":522},[84,1985,1656],{"class":137},[84,1987,1659],{"class":522},[84,1989,1662],{"class":522},[84,1991,1665],{"class":90},[84,1993,1994],{"class":571},"({\n",[84,1996,1997,2000,2002],{"class":86,"line":201},[84,1998,1999],{"class":571},"  entry: ",[84,2001,1671],{"class":94},[84,2003,2004],{"class":571},",\n",[84,2006,2007,2010,2013],{"class":86,"line":206},[84,2008,2009],{"class":522},"  get",[84,2011,2012],{"class":90}," srvxServer",[84,2014,2015],{"class":571},"() {\n",[84,2017,2018,2021],{"class":86,"line":213},[84,2019,2020],{"class":522},"    return",[84,2022,2023],{"class":571}," server;\n",[84,2025,2026],{"class":86,"line":234},[84,2027,2028],{"class":571},"  },\n",[84,2030,2031],{"class":86,"line":249},[84,2032,2033],{"class":571},"});\n",[84,2035,2036],{"class":86,"line":264},[84,2037,189],{"emptyLinePlaceholder":188},[84,2039,2040,2043,2046,2048,2051,2053,2056,2058],{"class":86,"line":279},[84,2041,2042],{"class":571},"server ",[84,2044,2045],{"class":522},"=",[84,2047,222],{"class":90},[84,2049,2050],{"class":571},"({ fetch: loaded.fetch",[84,2052,1725],{"class":522},[84,2054,2055],{"class":571},", port: ",[84,2057,718],{"class":137},[84,2059,1674],{"class":571},[62,2061,2062,2063,2066,2067,2070],{},"Anything the entry exports alongside its handler is on ",[66,2064,2065],{},"loaded.module",", so you can read its ",[1140,2068,2069],{"href":33},"server options"," and merge them with your own.",[62,2072,2073,2074,2077,2078,2081],{},"If the entry instead calls ",[66,2075,2076],{},"http.createServer(handler).listen()",", the loader captures ",[66,2079,2080],{},"handler"," and lets the entry run to completion without binding a port. Its listen callback still fires, so setup code that runs after listen is not skipped.",[62,2083,2084,2085,2088,2089,2092,2093,2095],{},"Pass ",[66,2086,2087],{},"interceptHttpListen: false"," to opt out. Note that this disables ",[1417,2090,2091],{},"both"," interceptions — an entry that calls ",[66,2094,1892],{}," will then really start listening on import.",[1440,2097,2098],{},[62,2099,2100,2101,2104],{},"\nEntries are intercepted one at a time — concurrent ",[66,2102,2103],{},"loadServerEntry"," calls are queued rather than run in parallel.",[1775,2106,2108],{"id":2107},"reloading-an-entry","Reloading an entry",[62,2110,2111,2112,2115,2116,2119,2120,2122,2123,2126,2127,2131],{},"The handler of an intercepted entry comes from a ",[1417,2113,2114],{},"side effect"," of the import, and ",[66,2117,2118],{},"import()"," caches modules per URL. Loading the same entry twice in one process returns the cached module without re-running it, so the interception never fires and ",[66,2121,1768],{}," comes back ",[66,2124,2125],{},"undefined",". Entries that ",[2128,2129,2130],"em",{},"export"," a handler are unaffected — their handler lives on the cached module.",[62,2133,2134],{},"If you need to load an entry more than once (a watch mode, for example), give each load a unique entry URL:",[74,2136,2138],{"className":1609,"code":2137,"language":1611,"meta":80,"style":80},"import { pathToFileURL } from \"node:url\";\n\nconst url = pathToFileURL(resolve(\"./server.ts\")).href;\nconst loaded = await loadServerEntry({ entry: `${url}?t=${Date.now()}` });\n",[66,2139,2140,2154,2158,2182],{"__ignoreMap":80},[84,2141,2142,2144,2147,2149,2152],{"class":86,"line":87},[84,2143,1618],{"class":522},[84,2145,2146],{"class":571}," { pathToFileURL } ",[84,2148,1624],{"class":522},[84,2150,2151],{"class":94}," \"node:url\"",[84,2153,1630],{"class":571},[84,2155,2156],{"class":86,"line":185},[84,2157,189],{"emptyLinePlaceholder":188},[84,2159,2160,2162,2165,2167,2170,2172,2175,2177,2179],{"class":86,"line":192},[84,2161,1653],{"class":522},[84,2163,2164],{"class":137}," url",[84,2166,1659],{"class":522},[84,2168,2169],{"class":90}," pathToFileURL",[84,2171,1700],{"class":571},[84,2173,2174],{"class":90},"resolve",[84,2176,1700],{"class":571},[84,2178,1671],{"class":94},[84,2180,2181],{"class":571},")).href;\n",[84,2183,2184,2186,2188,2190,2192,2194,2196,2199,2202,2205,2208,2210,2213,2216,2219],{"class":86,"line":201},[84,2185,1653],{"class":522},[84,2187,1656],{"class":137},[84,2189,1659],{"class":522},[84,2191,1662],{"class":522},[84,2193,1665],{"class":90},[84,2195,1668],{"class":571},[84,2197,2198],{"class":94},"`${",[84,2200,2201],{"class":571},"url",[84,2203,2204],{"class":94},"}?t=${",[84,2206,2207],{"class":571},"Date",[84,2209,1557],{"class":94},[84,2211,2212],{"class":90},"now",[84,2214,2215],{"class":94},"()",[84,2217,2218],{"class":94},"}`",[84,2220,1674],{"class":571},[62,2222,2223,2224,1557],{},"The query is ignored when checking that the file exists, and is preserved in the returned ",[66,2225,2201],{},[1440,2227,2228],{},[62,2229,2230,2231,2234],{},"\nEach reload leaves the previous module in the ESM cache for the lifetime of the process. For a long-running watch mode, restart a child process instead and let the runtime's own ",[66,2232,2233],{},"--watch"," handle reloads.",[1775,2236,2238],{"id":2237},"loadoptions",[66,2239,2240],{},"LoadOptions",[2242,2243,2244,2260,2273,2293,2305,2315,2334],"ul",{},[2245,2246,2247,2251,2252,2254,2255,2259],"li",{},[1417,2248,2249],{},[66,2250,1784],{}," — Path or ",[66,2253,1792],{}," URL of the server entry file. If omitted, the ",[1140,2256,2258],{"href":2257},"#entry-resolution","default entries"," are searched.",[2245,2261,2262,2266,2267,2269,2270,1557],{},[1417,2263,2264],{},[66,2265,1788],{}," — Base directory for resolving ",[66,2268,1784],{}," and for auto-discovery. Default is ",[66,2271,2272],{},"\".\"",[2245,2274,2275,2279,2280,2283,2284,2286,2287,2289,2290,1557],{},[1417,2276,2277],{},[66,2278,1909],{}," — Set to ",[66,2281,2282],{},"false"," to disable upgrading a legacy Node.js ",[66,2285,1913],{}," handler. The result then has no ",[66,2288,1768],{}," when the entry only exports a Node.js handler. Default is ",[66,2291,2292],{},"true",[2245,2294,2295,2279,2300,2302,2303,1557],{},[1417,2296,2297],{},[66,2298,2299],{},"interceptHttpListen",[66,2301,2282],{}," to import the entry without intercepting listen calls. Default is ",[66,2304,2292],{},[2245,2306,2307,2311,2312,2314],{},[1417,2308,2309],{},[66,2310,1943],{}," — The srvx server instance to hand to the entry when its ",[66,2313,1892],{}," call is intercepted. Define it as a getter when the instance is created after loading.",[2245,2316,2317,2322,2323,2326,2327,2330,2331,2333],{},[1417,2318,2319],{},[66,2320,2321],{},"nodeServer"," — The ",[66,2324,2325],{},"node:http"," server instance to return from an intercepted ",[66,2328,2329],{},"listen()",". Defaults to ",[66,2332,1943],{},"'s underlying Node.js server, or a stub that forwards to it once it exists.",[2245,2335,2336,2341],{},[1417,2337,2338],{},[66,2339,2340],{},"onLoad"," — Hook called with the imported module before the handler is resolved. Return a value to replace the module.",[1775,2343,2345],{"id":2344},"loadedserverentry",[66,2346,2347],{},"LoadedServerEntry",[2242,2349,2350,2360,2367,2377,2394,2409],{},[2245,2351,2352,2356,2357,2359],{},[1417,2353,2354],{},[66,2355,1768],{}," — The resolved web fetch handler, or ",[66,2358,2125],{}," if the entry exports none.",[2245,2361,2362,2366],{},[1417,2363,2364],{},[66,2365,1858],{}," — The raw imported module. Use it to read options the entry exports next to its handler.",[2245,2368,2369,2373,2374,2376],{},[1417,2370,2371],{},[66,2372,2201],{}," — The resolved ",[66,2375,1792],{}," URL of the loaded entry.",[2245,2378,2379,2383,2384,2386,2387,1844,2389,2391,2392,1557],{},[1417,2380,2381],{},[66,2382,1772],{}," — ",[66,2385,2292],{}," when no entry file could be located. ",[66,2388,1768],{},[66,2390,1858],{}," are then ",[66,2393,2125],{},[2245,2395,2396,2383,2400,2402,2403,2405,2406,1557],{},[1417,2397,2398],{},[66,2399,1909],{},[66,2401,2292],{}," when the handler was upgraded from a legacy Node.js ",[66,2404,1913],{}," handler. Serve it with ",[66,2407,2408],{},"srvx/node",[2245,2410,2411,2415,2416,2418],{},[1417,2412,2413],{},[66,2414,1943],{}," — The server instance the entry created via ",[66,2417,1892],{},", if that call was intercepted.",[1775,2420,2422],{"id":2421},"typescript-entries","TypeScript entries",[62,2424,2425,2426,2428],{},"The loader imports entries with a plain dynamic ",[66,2427,2118],{},", so TypeScript support comes from the runtime:",[2242,2430,2431,2443,2450],{},[2245,2432,2433,2436,2437,2439,2440,1557],{},[1417,2434,2435],{},"Node.js"," — requires v22.18+ or v24+ for ",[66,2438,1814],{}," entries. The loader throws a targeted error on older versions rather than a raw ",[66,2441,2442],{},"ERR_UNKNOWN_FILE_EXTENSION",[2245,2444,2445,1844,2447,2449],{},[1417,2446,127],{},[1417,2448,145],{}," — supported natively.",[2245,2451,2452,2455,2456,2462,2463,2468],{},[1417,2453,2454],{},"JSX"," — needs a loader such as ",[1140,2457,2461],{"href":2458,"rel":2459},"https://github.com/unjs/jiti",[2460],"nofollow","jiti",", preloaded with the ",[1140,2464,2466],{"href":2465},"#usage",[66,2467,1447],{}," flag.",[2470,2471,2472],"style",{},"html pre.shiki code .shcOC, html code.shiki .shcOC{--shiki-light:#6F42C1;--shiki-default:#B392F0;--shiki-dark:#B392F0}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}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}",{"title":80,"searchDepth":185,"depth":185,"links":2474},[2475,2476,2477,2478,2479,2480],{"id":161,"depth":185,"text":162},{"id":1360,"depth":185,"text":1361},{"id":1411,"depth":185,"text":1412},{"id":1437,"depth":185,"text":1438},{"id":1465,"depth":185,"text":1466},{"id":1598,"depth":185,"text":1599,"children":2481},[2482,2483,2484,2485,2486,2487,2488],{"id":1777,"depth":192,"text":1778},{"id":1861,"depth":192,"text":1862},{"id":1928,"depth":192,"text":1897},{"id":2107,"depth":192,"text":2108},{"id":2237,"depth":192,"text":2240},{"id":2344,"depth":192,"text":2347},{"id":2421,"depth":192,"text":2422},"Use the srvx CLI command to easily start a development or production server.","md",{"automd":188,"icon":15},{"icon":15},{"title":12,"description":2489},"rFvyYuuKH_8s2OMui8-dhXoo67A6LGCpp7QN_xlT3p0",[2496,2498],{"title":5,"path":6,"stem":7,"description":2497,"icon":10,"children":-1},"Build HTTP servers with web standard APIs like fetch, Request, and Response.",{"title":17,"path":18,"stem":19,"description":2499,"icon":20,"children":-1},"Get familiar with srvx fetch server handler and ServerRequest.",1784376632891]