[{"data":1,"prerenderedAt":1441},["ShallowReactive",2],{"navigation":3,"\u002Fdocs\u002Fpackages\u002Fnode-server":176,"\u002Fdocs\u002Fpackages\u002Fnode-server-surround":1436},[4,21,86,158],{"title":5,"path":6,"stem":7,"children":8,"status":11,"icon":20},"Getting Started","\u002Fdocs\u002Fgetting-started","1.docs\u002F1.getting-started\u002F1.index",[9,12,16],{"title":10,"path":6,"stem":7,"status":11},"Introduction",null,{"title":13,"path":14,"stem":15,"status":11},"Installation","\u002Fdocs\u002Fgetting-started\u002Finstallation","1.docs\u002F1.getting-started\u002F2.installation",{"title":17,"path":18,"stem":19,"status":11},"Quick Start","\u002Fdocs\u002Fgetting-started\u002Fquick-start","1.docs\u002F1.getting-started\u002F3.quick-start",false,{"title":22,"path":23,"stem":24,"children":25,"status":11,"icon":20},"Core Concepts","\u002Fdocs\u002Fcore-concepts","1.docs\u002F2.core-concepts\u002F1.index",[26,28,32,36,46,50,54,58,62,66,70,74,78,82],{"title":27,"path":23,"stem":24,"status":11},"Overview",{"title":29,"path":30,"stem":31,"status":11},"Response","\u002Fdocs\u002Fcore-concepts\u002Fresponse","1.docs\u002F2.core-concepts\u002F10.response",{"title":33,"path":34,"stem":35,"status":11},"Testing","\u002Fdocs\u002Fcore-concepts\u002Ftesting","1.docs\u002F2.core-concepts\u002F12.testing",{"title":37,"path":38,"stem":39,"children":40,"status":11,"icon":20,"defaultOpen":20},"Decorators","\u002Fdocs\u002Fcore-concepts\u002Fdecorators","1.docs\u002F2.core-concepts\u002F13.decorators\u002F1.index",[41,42],{"title":27,"path":38,"stem":39,"status":11},{"title":43,"path":44,"stem":45,"status":11},"Custom","\u002Fdocs\u002Fcore-concepts\u002Fdecorators\u002Fcustom","1.docs\u002F2.core-concepts\u002F13.decorators\u002F2.custom",{"title":47,"path":48,"stem":49,"status":11},"Discovery Service","\u002Fdocs\u002Fcore-concepts\u002Fdiscovery","1.docs\u002F2.core-concepts\u002F14.discovery",{"title":51,"path":52,"stem":53,"status":11},"Application Lifecycle","\u002Fdocs\u002Fcore-concepts\u002Fapp-lifecycle","1.docs\u002F2.core-concepts\u002F15.app-lifecycle",{"title":55,"path":56,"stem":57,"status":11},"Controllers","\u002Fdocs\u002Fcore-concepts\u002Fcontrollers","1.docs\u002F2.core-concepts\u002F2.controllers",{"title":59,"path":60,"stem":61,"status":11},"Routing","\u002Fdocs\u002Fcore-concepts\u002Frouting","1.docs\u002F2.core-concepts\u002F3.routing",{"title":63,"path":64,"stem":65,"status":11},"Providers","\u002Fdocs\u002Fcore-concepts\u002Fproviders","1.docs\u002F2.core-concepts\u002F4.providers",{"title":67,"path":68,"stem":69,"status":11},"Modules","\u002Fdocs\u002Fcore-concepts\u002Fmodules","1.docs\u002F2.core-concepts\u002F5.modules",{"title":71,"path":72,"stem":73,"status":11},"Configuration","\u002Fdocs\u002Fcore-concepts\u002Fconfiguration","1.docs\u002F2.core-concepts\u002F6.configuration",{"title":75,"path":76,"stem":77,"status":11},"Middleware","\u002Fdocs\u002Fcore-concepts\u002Fmiddleware","1.docs\u002F2.core-concepts\u002F7.middleware",{"title":79,"path":80,"stem":81,"status":11},"Guards","\u002Fdocs\u002Fcore-concepts\u002Fguards","1.docs\u002F2.core-concepts\u002F8.guards",{"title":83,"path":84,"stem":85,"status":11},"Exceptions","\u002Fdocs\u002Fcore-concepts\u002Fexceptions","1.docs\u002F2.core-concepts\u002F9.exceptions",{"title":87,"path":88,"stem":89,"children":90,"status":11,"icon":20},"Packages","\u002Fdocs\u002Fpackages","1.docs\u002F3.packages\u002F1.index",[91,92,97,108,112,130,134,138,142,146,150,154],{"title":27,"path":88,"stem":89,"status":11},{"title":93,"path":94,"stem":95,"status":96},"CLI","\u002Fdocs\u002Fpackages\u002Fcli","1.docs\u002F3.packages\u002F10.cli","experimental",{"title":98,"path":99,"stem":100,"children":101,"status":11,"icon":20,"defaultOpen":20},"Events","\u002Fdocs\u002Fpackages\u002Fmessaging","1.docs\u002F3.packages\u002F11.messaging\u002F1.index",[102,104],{"title":27,"path":99,"stem":100,"status":103},"beta",{"title":105,"path":106,"stem":107,"status":96},"Redis","\u002Fdocs\u002Fpackages\u002Fmessaging\u002Fredis","1.docs\u002F3.packages\u002F11.messaging\u002F2.redis",{"title":109,"path":110,"stem":111,"status":103},"Serve Static","\u002Fdocs\u002Fpackages\u002Fserve-static","1.docs\u002F3.packages\u002F12.serve-static",{"title":113,"path":114,"stem":115,"children":116,"status":11,"icon":20,"defaultOpen":20},"Auth","\u002Fdocs\u002Fpackages\u002Fauth","1.docs\u002F3.packages\u002F2.auth\u002F1.index",[117,118,122,126],{"title":27,"path":114,"stem":115,"status":103},{"title":119,"path":120,"stem":121,"status":103},"JWT Provider","\u002Fdocs\u002Fpackages\u002Fauth\u002Fjwt","1.docs\u002F3.packages\u002F2.auth\u002F2.jwt",{"title":123,"path":124,"stem":125,"status":103},"Local Provider","\u002Fdocs\u002Fpackages\u002Fauth\u002Flocal","1.docs\u002F3.packages\u002F2.auth\u002F3.local",{"title":127,"path":128,"stem":129,"status":96},"OAuth2 Provider","\u002Fdocs\u002Fpackages\u002Fauth\u002Foauth2","1.docs\u002F3.packages\u002F2.auth\u002F4.oauth2",{"title":131,"path":132,"stem":133,"status":103},"JWT","\u002Fdocs\u002Fpackages\u002Fjwt","1.docs\u002F3.packages\u002F3.jwt",{"title":135,"path":136,"stem":137,"status":103},"Drizzle","\u002Fdocs\u002Fpackages\u002Fdrizzle","1.docs\u002F3.packages\u002F4.drizzle",{"title":139,"path":140,"stem":141,"status":103},"Papr","\u002Fdocs\u002Fpackages\u002Fpapr","1.docs\u002F3.packages\u002F5.papr",{"title":143,"path":144,"stem":145,"status":103},"Mongoose","\u002Fdocs\u002Fpackages\u002Fmongoose","1.docs\u002F3.packages\u002F6.mongoose",{"title":147,"path":148,"stem":149,"status":103},"Swagger","\u002Fdocs\u002Fpackages\u002Fswagger","1.docs\u002F3.packages\u002F7.swagger",{"title":151,"path":152,"stem":153,"status":103},"Node Server","\u002Fdocs\u002Fpackages\u002Fnode-server","1.docs\u002F3.packages\u002F8.node-server",{"title":155,"path":156,"stem":157,"status":103},"uWS Server","\u002Fdocs\u002Fpackages\u002Fuws-server","1.docs\u002F3.packages\u002F9.uws-server",{"title":159,"path":160,"stem":161,"children":162,"status":11,"icon":20},"Roadmap","\u002Fdocs\u002Froadmap","1.docs\u002F4.roadmap\u002F1.index",[163,164,168,172],{"title":27,"path":160,"stem":161,"status":11},{"title":165,"path":166,"stem":167,"status":11},"Short term (0-3 months)","\u002Fdocs\u002Froadmap\u002Fshort-term","1.docs\u002F4.roadmap\u002F2.short-term",{"title":169,"path":170,"stem":171,"status":11},"Mid term (3-9 months)","\u002Fdocs\u002Froadmap\u002Fmid-term","1.docs\u002F4.roadmap\u002F3.mid-term",{"title":173,"path":174,"stem":175,"status":11},"Long term (9-12+ months)","\u002Fdocs\u002Froadmap\u002Flong-term","1.docs\u002F4.roadmap\u002F4.long-term",{"id":177,"title":151,"body":178,"description":1431,"extension":1432,"meta":1433,"navigation":329,"path":152,"seo":1434,"status":103,"stem":153,"__hash__":1435},"docs\u002F1.docs\u002F3.packages\u002F8.node-server.md",{"type":179,"value":180,"toc":1418},"minimark",[181,189,193,264,268,394,397,430,434,455,459,462,467,470,549,553,561,663,670,674,677,817,821,941,962,966,978,1042,1045,1062,1399,1414],[182,183,184,188],"p",{},[185,186,187],"code",{},"@miiajs\u002Fnode-server"," provides a high-performance Node.js HTTP server adapter for MiiaJS.",[190,191,13],"h2",{"id":192},"installation",[194,195,196,221,236,250],"code-group",{},[197,198,204],"pre",{"className":199,"code":200,"filename":201,"language":202,"meta":203,"style":203},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","bun add @miiajs\u002Fnode-server\n","bun","bash","",[185,205,206],{"__ignoreMap":203},[207,208,211,214,218],"span",{"class":209,"line":210},"line",1,[207,212,201],{"class":213},"sBMFI",[207,215,217],{"class":216},"sfazB"," add",[207,219,220],{"class":216}," @miiajs\u002Fnode-server\n",[197,222,225],{"className":199,"code":223,"filename":224,"language":202,"meta":203,"style":203},"npm install @miiajs\u002Fnode-server\n","npm",[185,226,227],{"__ignoreMap":203},[207,228,229,231,234],{"class":209,"line":210},[207,230,224],{"class":213},[207,232,233],{"class":216}," install",[207,235,220],{"class":216},[197,237,240],{"className":199,"code":238,"filename":239,"language":202,"meta":203,"style":203},"pnpm add @miiajs\u002Fnode-server\n","pnpm",[185,241,242],{"__ignoreMap":203},[207,243,244,246,248],{"class":209,"line":210},[207,245,239],{"class":213},[207,247,217],{"class":216},[207,249,220],{"class":216},[197,251,254],{"className":199,"code":252,"filename":253,"language":202,"meta":203,"style":203},"yarn add @miiajs\u002Fnode-server\n","yarn",[185,255,256],{"__ignoreMap":203},[207,257,258,260,262],{"class":209,"line":210},[207,259,253],{"class":213},[207,261,217],{"class":216},[207,263,220],{"class":216},[190,265,267],{"id":266},"usage","Usage",[197,269,273],{"className":270,"code":271,"language":272,"meta":203,"style":203},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { Miia } from '@miiajs\u002Fcore'\nimport { serve } from '@miiajs\u002Fnode-server'\n\nconst app = new Miia().register(AppModule)\n\nawait app.listen(3000, serve)\n","typescript",[185,274,275,304,324,331,362,367],{"__ignoreMap":203},[207,276,277,281,285,289,292,295,298,301],{"class":209,"line":210},[207,278,280],{"class":279},"s7zQu","import",[207,282,284],{"class":283},"sMK4o"," {",[207,286,288],{"class":287},"sTEyZ"," Miia",[207,290,291],{"class":283}," }",[207,293,294],{"class":279}," from",[207,296,297],{"class":283}," '",[207,299,300],{"class":216},"@miiajs\u002Fcore",[207,302,303],{"class":283},"'\n",[207,305,307,309,311,314,316,318,320,322],{"class":209,"line":306},2,[207,308,280],{"class":279},[207,310,284],{"class":283},[207,312,313],{"class":287}," serve",[207,315,291],{"class":283},[207,317,294],{"class":279},[207,319,297],{"class":283},[207,321,187],{"class":216},[207,323,303],{"class":283},[207,325,327],{"class":209,"line":326},3,[207,328,330],{"emptyLinePlaceholder":329},true,"\n",[207,332,334,338,341,344,347,350,353,356,359],{"class":209,"line":333},4,[207,335,337],{"class":336},"spNyl","const",[207,339,340],{"class":287}," app ",[207,342,343],{"class":283},"=",[207,345,346],{"class":283}," new",[207,348,288],{"class":349},"s2Zo4",[207,351,352],{"class":287},"()",[207,354,355],{"class":283},".",[207,357,358],{"class":349},"register",[207,360,361],{"class":287},"(AppModule)\n",[207,363,365],{"class":209,"line":364},5,[207,366,330],{"emptyLinePlaceholder":329},[207,368,370,373,376,378,381,384,388,391],{"class":209,"line":369},6,[207,371,372],{"class":279},"await",[207,374,375],{"class":287}," app",[207,377,355],{"class":283},[207,379,380],{"class":349},"listen",[207,382,383],{"class":287},"(",[207,385,387],{"class":386},"sbssI","3000",[207,389,390],{"class":283},",",[207,392,393],{"class":287}," serve)\n",[182,395,396],{},"With custom hostname:",[197,398,400],{"className":270,"code":399,"language":272,"meta":203,"style":203},"await app.listen(3000, 'localhost', serve)\n",[185,401,402],{"__ignoreMap":203},[207,403,404,406,408,410,412,414,416,418,420,423,426,428],{"class":209,"line":210},[207,405,372],{"class":279},[207,407,375],{"class":287},[207,409,355],{"class":283},[207,411,380],{"class":349},[207,413,383],{"class":287},[207,415,387],{"class":386},[207,417,390],{"class":283},[207,419,297],{"class":283},[207,421,422],{"class":216},"localhost",[207,424,425],{"class":283},"'",[207,427,390],{"class":283},[207,429,393],{"class":287},[190,431,433],{"id":432},"how-it-works","How it works",[182,435,436,437,440,441,444,445,448,449,444,452,454],{},"The ",[185,438,439],{},"serve"," function bridges Node.js's ",[185,442,443],{},"http.IncomingMessage","\u002F",[185,446,447],{},"http.ServerResponse"," and the Web Standard ",[185,450,451],{},"Request",[185,453,29],{}," API that MiiaJS uses internally.",[190,456,458],{"id":457},"performance-modes","Performance modes",[182,460,461],{},"The adapter supports two modes:",[463,464,466],"h3",{"id":465},"optimized-mode-default","Optimized mode (default)",[182,468,469],{},"Minimizes allocations on the hot path:",[471,472,473,485,506,526,539],"ul",{},[474,475,476,480,481,484],"li",{},[477,478,479],"strong",{},"Lazy Request Proxy"," - lightweight object instead of ",[185,482,483],{},"new Request()",". Method, URL, headers, and body are resolved only on first access.",[474,486,487,490,491,494,495,498,499,498,502,505],{},[477,488,489],{},"Lightweight Headers"," - linear scan over raw header pairs instead of constructing a ",[185,492,493],{},"Headers"," object. Covers ",[185,496,497],{},".get()",", ",[185,500,501],{},".has()",[185,503,504],{},".forEach()",", and iterators.",[474,507,508,511,512,515,516,519,520,522,523,355],{},[477,509,510],{},"Body Buffering"," - small POST bodies (Content-Length ≤ ",[185,513,514],{},"bufferThreshold",") are buffered and parsed directly, bypassing ",[185,517,518],{},"ReadableStream"," and ",[185,521,451],{}," creation. Large or chunked bodies fall back to streaming via ",[185,524,525],{},"Readable.toWeb()",[474,527,528,531,532,535,536,538],{},[477,529,530],{},"LightResponse Cache"," - simple responses (string, null, Uint8Array) store a ",[185,533,534],{},"[status, body, headers]"," tuple without creating a real ",[185,537,29],{}," object.",[474,540,541,544,545,548],{},[477,542,543],{},"Sync Fast Path"," - synchronous handlers bypass ",[185,546,547],{},"Promise"," allocation entirely.",[463,550,552],{"id":551},"native-mode","Native mode",[182,554,555,556,519,558,560],{},"Full Web API compliance with standard ",[185,557,451],{},[185,559,29],{}," objects:",[197,562,564],{"className":270,"code":563,"language":272,"meta":203,"style":203},"import { serve } from '@miiajs\u002Fnode-server'\n\nconst server = await serve({\n  fetch: app.fetch,\n  port: 3000,\n  mode: 'native',\n})\n",[185,565,566,584,588,607,626,638,654],{"__ignoreMap":203},[207,567,568,570,572,574,576,578,580,582],{"class":209,"line":210},[207,569,280],{"class":279},[207,571,284],{"class":283},[207,573,313],{"class":287},[207,575,291],{"class":283},[207,577,294],{"class":279},[207,579,297],{"class":283},[207,581,187],{"class":216},[207,583,303],{"class":283},[207,585,586],{"class":209,"line":306},[207,587,330],{"emptyLinePlaceholder":329},[207,589,590,592,595,597,600,602,604],{"class":209,"line":326},[207,591,337],{"class":336},[207,593,594],{"class":287}," server ",[207,596,343],{"class":283},[207,598,599],{"class":279}," await",[207,601,313],{"class":349},[207,603,383],{"class":287},[207,605,606],{"class":283},"{\n",[207,608,609,613,616,618,620,623],{"class":209,"line":333},[207,610,612],{"class":611},"swJcz","  fetch",[207,614,615],{"class":283},":",[207,617,375],{"class":287},[207,619,355],{"class":283},[207,621,622],{"class":287},"fetch",[207,624,625],{"class":283},",\n",[207,627,628,631,633,636],{"class":209,"line":364},[207,629,630],{"class":611},"  port",[207,632,615],{"class":283},[207,634,635],{"class":386}," 3000",[207,637,625],{"class":283},[207,639,640,643,645,647,650,652],{"class":209,"line":369},[207,641,642],{"class":611},"  mode",[207,644,615],{"class":283},[207,646,297],{"class":283},[207,648,649],{"class":216},"native",[207,651,425],{"class":283},[207,653,625],{"class":283},[207,655,657,660],{"class":209,"line":656},7,[207,658,659],{"class":283},"}",[207,661,662],{"class":287},")\n",[182,664,665,666,669],{},"Use native mode when you need strict ",[185,667,668],{},"instanceof Response"," checks or run multiple frameworks in the same process.",[190,671,673],{"id":672},"standalone-usage","Standalone usage",[182,675,676],{},"The adapter can be used without the MiiaJS framework:",[197,678,680],{"className":270,"code":679,"language":272,"meta":203,"style":203},"import { serve } from '@miiajs\u002Fnode-server'\n\nconst server = await serve({\n  fetch: (req) => new Response('Hello, World!'),\n  port: 3000,\n  hostname: '0.0.0.0',\n})\n\n\u002F\u002F Later...\nawait server.close()\n",[185,681,682,700,704,720,757,767,783,789,794,801],{"__ignoreMap":203},[207,683,684,686,688,690,692,694,696,698],{"class":209,"line":210},[207,685,280],{"class":279},[207,687,284],{"class":283},[207,689,313],{"class":287},[207,691,291],{"class":283},[207,693,294],{"class":279},[207,695,297],{"class":283},[207,697,187],{"class":216},[207,699,303],{"class":283},[207,701,702],{"class":209,"line":306},[207,703,330],{"emptyLinePlaceholder":329},[207,705,706,708,710,712,714,716,718],{"class":209,"line":326},[207,707,337],{"class":336},[207,709,594],{"class":287},[207,711,343],{"class":283},[207,713,599],{"class":279},[207,715,313],{"class":349},[207,717,383],{"class":287},[207,719,606],{"class":283},[207,721,722,724,726,729,733,736,739,741,744,746,748,751,753,755],{"class":209,"line":333},[207,723,612],{"class":349},[207,725,615],{"class":283},[207,727,728],{"class":283}," (",[207,730,732],{"class":731},"sHdIc","req",[207,734,735],{"class":283},")",[207,737,738],{"class":336}," =>",[207,740,346],{"class":283},[207,742,743],{"class":349}," Response",[207,745,383],{"class":287},[207,747,425],{"class":283},[207,749,750],{"class":216},"Hello, World!",[207,752,425],{"class":283},[207,754,735],{"class":287},[207,756,625],{"class":283},[207,758,759,761,763,765],{"class":209,"line":364},[207,760,630],{"class":611},[207,762,615],{"class":283},[207,764,635],{"class":386},[207,766,625],{"class":283},[207,768,769,772,774,776,779,781],{"class":209,"line":369},[207,770,771],{"class":611},"  hostname",[207,773,615],{"class":283},[207,775,297],{"class":283},[207,777,778],{"class":216},"0.0.0.0",[207,780,425],{"class":283},[207,782,625],{"class":283},[207,784,785,787],{"class":209,"line":656},[207,786,659],{"class":283},[207,788,662],{"class":287},[207,790,792],{"class":209,"line":791},8,[207,793,330],{"emptyLinePlaceholder":329},[207,795,797],{"class":209,"line":796},9,[207,798,800],{"class":799},"sHwdD","\u002F\u002F Later...\n",[207,802,804,806,809,811,814],{"class":209,"line":803},10,[207,805,372],{"class":279},[207,807,808],{"class":287}," server",[207,810,355],{"class":283},[207,812,813],{"class":349},"close",[207,815,816],{"class":287},"()\n",[190,818,820],{"id":819},"options","Options",[197,822,824],{"className":270,"code":823,"language":272,"meta":203,"style":203},"interface ServeOptions {\n  fetch: (req: Request) => Response | Promise\u003CResponse>  \u002F\u002F Required\n  port?: number              \u002F\u002F Default: 3000\n  hostname?: string          \u002F\u002F Default: '0.0.0.0'\n  mode?: 'optimized' | 'native'  \u002F\u002F Default: 'optimized'\n  bufferThreshold?: number   \u002F\u002F Default: 102400 (100KB)\n}\n",[185,825,826,837,875,888,900,924,936],{"__ignoreMap":203},[207,827,828,831,834],{"class":209,"line":210},[207,829,830],{"class":336},"interface",[207,832,833],{"class":213}," ServeOptions",[207,835,836],{"class":283}," {\n",[207,838,839,841,843,845,847,849,852,854,856,858,861,864,867,869,872],{"class":209,"line":306},[207,840,612],{"class":611},[207,842,615],{"class":283},[207,844,728],{"class":283},[207,846,732],{"class":731},[207,848,615],{"class":283},[207,850,851],{"class":213}," Request",[207,853,735],{"class":283},[207,855,738],{"class":336},[207,857,743],{"class":213},[207,859,860],{"class":283}," |",[207,862,863],{"class":213}," Promise",[207,865,866],{"class":283},"\u003C",[207,868,29],{"class":213},[207,870,871],{"class":283},">",[207,873,874],{"class":799},"  \u002F\u002F Required\n",[207,876,877,879,882,885],{"class":209,"line":326},[207,878,630],{"class":611},[207,880,881],{"class":283},"?:",[207,883,884],{"class":213}," number",[207,886,887],{"class":799},"              \u002F\u002F Default: 3000\n",[207,889,890,892,894,897],{"class":209,"line":333},[207,891,771],{"class":611},[207,893,881],{"class":283},[207,895,896],{"class":213}," string",[207,898,899],{"class":799},"          \u002F\u002F Default: '0.0.0.0'\n",[207,901,902,904,906,908,911,913,915,917,919,921],{"class":209,"line":364},[207,903,642],{"class":611},[207,905,881],{"class":283},[207,907,297],{"class":283},[207,909,910],{"class":216},"optimized",[207,912,425],{"class":283},[207,914,860],{"class":283},[207,916,297],{"class":283},[207,918,649],{"class":216},[207,920,425],{"class":283},[207,922,923],{"class":799},"  \u002F\u002F Default: 'optimized'\n",[207,925,926,929,931,933],{"class":209,"line":369},[207,927,928],{"class":611},"  bufferThreshold",[207,930,881],{"class":283},[207,932,884],{"class":213},[207,934,935],{"class":799},"   \u002F\u002F Default: 102400 (100KB)\n",[207,937,938],{"class":209,"line":656},[207,939,940],{"class":283},"}\n",[182,942,436,943,945,946,949,950,444,953,956,957,959,960,355],{},[185,944,514],{}," controls the body buffering optimization in optimized mode. POST\u002FPUT\u002FPATCH bodies with a known ",[185,947,948],{},"Content-Length"," up to this size are buffered in memory for fast ",[185,951,952],{},"json()",[185,954,955],{},"text()"," access. Bodies without ",[185,958,948],{}," or larger than the threshold use streaming via ",[185,961,525],{},[190,963,965],{"id":964},"serverhandle","ServerHandle",[182,967,436,968,970,971,973,974,977],{},[185,969,439],{}," function returns a ",[185,972,965],{}," with a ",[185,975,976],{},"close()"," method:",[197,979,981],{"className":270,"code":980,"language":272,"meta":203,"style":203},"const server = await serve({ fetch: handler, port: 3000 })\n\n\u002F\u002F Graceful shutdown\nawait server.close()\n",[185,982,983,1021,1025,1030],{"__ignoreMap":203},[207,984,985,987,989,991,993,995,997,1000,1003,1005,1008,1010,1013,1015,1017,1019],{"class":209,"line":210},[207,986,337],{"class":336},[207,988,594],{"class":287},[207,990,343],{"class":283},[207,992,599],{"class":279},[207,994,313],{"class":349},[207,996,383],{"class":287},[207,998,999],{"class":283},"{",[207,1001,1002],{"class":611}," fetch",[207,1004,615],{"class":283},[207,1006,1007],{"class":287}," handler",[207,1009,390],{"class":283},[207,1011,1012],{"class":611}," port",[207,1014,615],{"class":283},[207,1016,635],{"class":386},[207,1018,291],{"class":283},[207,1020,662],{"class":287},[207,1022,1023],{"class":209,"line":306},[207,1024,330],{"emptyLinePlaceholder":329},[207,1026,1027],{"class":209,"line":326},[207,1028,1029],{"class":799},"\u002F\u002F Graceful shutdown\n",[207,1031,1032,1034,1036,1038,1040],{"class":209,"line":333},[207,1033,372],{"class":279},[207,1035,808],{"class":287},[207,1037,355],{"class":283},[207,1039,813],{"class":349},[207,1041,816],{"class":287},[190,1043,33],{"id":1044},"testing",[182,1046,1047,1049,1050,1053,1054,1057,1058,1061],{},[185,1048,187],{}," is exercised directly - ",[185,1051,1052],{},"serve()"," accepts any ",[185,1055,1056],{},"(req: Request) => Response | Promise\u003CResponse>",", so you don't need a ",[185,1059,1060],{},"Miia"," instance to test it.",[197,1063,1065],{"className":270,"code":1064,"language":272,"meta":203,"style":203},"import { afterEach, expect, it } from 'bun:test'\nimport { serve, type ServerHandle } from '@miiajs\u002Fnode-server'\n\nlet server: ServerHandle\n\nafterEach(async () => {\n  if (server) await server.close()\n})\n\nit('handles GET requests', async () => {\n  server = await serve({\n    port: 18234,\n    fetch: () => Response.json({ ok: true }),\n  })\n\n  const res = await fetch('http:\u002F\u002Flocalhost:18234\u002F')\n  expect(res.status).toBe(200)\n  expect(await res.json()).toEqual({ ok: true })\n})\n",[185,1066,1067,1097,1123,1127,1139,1143,1160,1183,1189,1193,1218,1235,1248,1286,1294,1299,1325,1355,1392],{"__ignoreMap":203},[207,1068,1069,1071,1073,1076,1078,1081,1083,1086,1088,1090,1092,1095],{"class":209,"line":210},[207,1070,280],{"class":279},[207,1072,284],{"class":283},[207,1074,1075],{"class":287}," afterEach",[207,1077,390],{"class":283},[207,1079,1080],{"class":287}," expect",[207,1082,390],{"class":283},[207,1084,1085],{"class":287}," it",[207,1087,291],{"class":283},[207,1089,294],{"class":279},[207,1091,297],{"class":283},[207,1093,1094],{"class":216},"bun:test",[207,1096,303],{"class":283},[207,1098,1099,1101,1103,1105,1107,1110,1113,1115,1117,1119,1121],{"class":209,"line":306},[207,1100,280],{"class":279},[207,1102,284],{"class":283},[207,1104,313],{"class":287},[207,1106,390],{"class":283},[207,1108,1109],{"class":279}," type",[207,1111,1112],{"class":287}," ServerHandle",[207,1114,291],{"class":283},[207,1116,294],{"class":279},[207,1118,297],{"class":283},[207,1120,187],{"class":216},[207,1122,303],{"class":283},[207,1124,1125],{"class":209,"line":326},[207,1126,330],{"emptyLinePlaceholder":329},[207,1128,1129,1132,1134,1136],{"class":209,"line":333},[207,1130,1131],{"class":336},"let",[207,1133,808],{"class":287},[207,1135,615],{"class":283},[207,1137,1138],{"class":213}," ServerHandle\n",[207,1140,1141],{"class":209,"line":364},[207,1142,330],{"emptyLinePlaceholder":329},[207,1144,1145,1148,1150,1153,1156,1158],{"class":209,"line":369},[207,1146,1147],{"class":349},"afterEach",[207,1149,383],{"class":287},[207,1151,1152],{"class":336},"async",[207,1154,1155],{"class":283}," ()",[207,1157,738],{"class":336},[207,1159,836],{"class":283},[207,1161,1162,1165,1167,1170,1173,1175,1177,1179,1181],{"class":209,"line":656},[207,1163,1164],{"class":279},"  if",[207,1166,728],{"class":611},[207,1168,1169],{"class":287},"server",[207,1171,1172],{"class":611},") ",[207,1174,372],{"class":279},[207,1176,808],{"class":287},[207,1178,355],{"class":283},[207,1180,813],{"class":349},[207,1182,816],{"class":611},[207,1184,1185,1187],{"class":209,"line":791},[207,1186,659],{"class":283},[207,1188,662],{"class":287},[207,1190,1191],{"class":209,"line":796},[207,1192,330],{"emptyLinePlaceholder":329},[207,1194,1195,1198,1200,1202,1205,1207,1209,1212,1214,1216],{"class":209,"line":803},[207,1196,1197],{"class":349},"it",[207,1199,383],{"class":287},[207,1201,425],{"class":283},[207,1203,1204],{"class":216},"handles GET requests",[207,1206,425],{"class":283},[207,1208,390],{"class":283},[207,1210,1211],{"class":336}," async",[207,1213,1155],{"class":283},[207,1215,738],{"class":336},[207,1217,836],{"class":283},[207,1219,1221,1224,1227,1229,1231,1233],{"class":209,"line":1220},11,[207,1222,1223],{"class":287},"  server",[207,1225,1226],{"class":283}," =",[207,1228,599],{"class":279},[207,1230,313],{"class":349},[207,1232,383],{"class":611},[207,1234,606],{"class":283},[207,1236,1238,1241,1243,1246],{"class":209,"line":1237},12,[207,1239,1240],{"class":611},"    port",[207,1242,615],{"class":283},[207,1244,1245],{"class":386}," 18234",[207,1247,625],{"class":283},[207,1249,1251,1254,1256,1258,1260,1262,1264,1267,1269,1271,1274,1276,1280,1282,1284],{"class":209,"line":1250},13,[207,1252,1253],{"class":349},"    fetch",[207,1255,615],{"class":283},[207,1257,1155],{"class":283},[207,1259,738],{"class":336},[207,1261,743],{"class":287},[207,1263,355],{"class":283},[207,1265,1266],{"class":349},"json",[207,1268,383],{"class":611},[207,1270,999],{"class":283},[207,1272,1273],{"class":611}," ok",[207,1275,615],{"class":283},[207,1277,1279],{"class":1278},"sfNiH"," true",[207,1281,291],{"class":283},[207,1283,735],{"class":611},[207,1285,625],{"class":283},[207,1287,1289,1292],{"class":209,"line":1288},14,[207,1290,1291],{"class":283},"  }",[207,1293,662],{"class":611},[207,1295,1297],{"class":209,"line":1296},15,[207,1298,330],{"emptyLinePlaceholder":329},[207,1300,1302,1305,1308,1310,1312,1314,1316,1318,1321,1323],{"class":209,"line":1301},16,[207,1303,1304],{"class":336},"  const",[207,1306,1307],{"class":287}," res",[207,1309,1226],{"class":283},[207,1311,599],{"class":279},[207,1313,1002],{"class":349},[207,1315,383],{"class":611},[207,1317,425],{"class":283},[207,1319,1320],{"class":216},"http:\u002F\u002Flocalhost:18234\u002F",[207,1322,425],{"class":283},[207,1324,662],{"class":611},[207,1326,1328,1331,1333,1336,1338,1341,1343,1345,1348,1350,1353],{"class":209,"line":1327},17,[207,1329,1330],{"class":349},"  expect",[207,1332,383],{"class":611},[207,1334,1335],{"class":287},"res",[207,1337,355],{"class":283},[207,1339,1340],{"class":287},"status",[207,1342,735],{"class":611},[207,1344,355],{"class":283},[207,1346,1347],{"class":349},"toBe",[207,1349,383],{"class":611},[207,1351,1352],{"class":386},"200",[207,1354,662],{"class":611},[207,1356,1358,1360,1362,1364,1366,1368,1370,1373,1375,1378,1380,1382,1384,1386,1388,1390],{"class":209,"line":1357},18,[207,1359,1330],{"class":349},[207,1361,383],{"class":611},[207,1363,372],{"class":279},[207,1365,1307],{"class":287},[207,1367,355],{"class":283},[207,1369,1266],{"class":349},[207,1371,1372],{"class":611},"())",[207,1374,355],{"class":283},[207,1376,1377],{"class":349},"toEqual",[207,1379,383],{"class":611},[207,1381,999],{"class":283},[207,1383,1273],{"class":611},[207,1385,615],{"class":283},[207,1387,1279],{"class":1278},[207,1389,291],{"class":283},[207,1391,662],{"class":611},[207,1393,1395,1397],{"class":209,"line":1394},19,[207,1396,659],{"class":283},[207,1398,662],{"class":287},[182,1400,1401,1402,1405,1406,1409,1410,1413],{},"For applications that wire the adapter through ",[185,1403,1404],{},"app.listen(port, host, serve)",", prefer the ",[185,1407,1408],{},"TestApp"," pattern from ",[1411,1412,33],"a",{"href":34}," - it runs handlers without binding a port and works under any runtime.",[1415,1416,1417],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}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 .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}",{"title":203,"searchDepth":306,"depth":306,"links":1419},[1420,1421,1422,1423,1427,1428,1429,1430],{"id":192,"depth":306,"text":13},{"id":266,"depth":306,"text":267},{"id":432,"depth":306,"text":433},{"id":457,"depth":306,"text":458,"children":1424},[1425,1426],{"id":465,"depth":326,"text":466},{"id":551,"depth":326,"text":552},{"id":672,"depth":306,"text":673},{"id":819,"depth":306,"text":820},{"id":964,"depth":306,"text":965},{"id":1044,"depth":306,"text":33},"Node.js HTTP server adapter with optimized request\u002Fresponse handling.","md",{},{"title":151,"description":1431},"DzQ4XQUIykvY8H8Bgd35o3z3NJd3jFACjJv9MwCc_ZU",[1437,1439],{"title":147,"path":148,"stem":149,"description":1438,"children":-1},"Generate OpenAPI 3.1 specs and serve Swagger UI from controller metadata.",{"title":155,"path":156,"stem":157,"description":1440,"children":-1},"uWebSockets.js HTTP server adapter for maximum throughput.",1778575274378]