[{"data":1,"prerenderedAt":450},["ShallowReactive",2],{"catalog-module-api":3},{"id":4,"category":5,"description":7,"documentation":8,"extension":9,"github":8,"icon":10,"interface":11,"meta":13,"name":12,"npm":14,"official":15,"repo":16,"sponsor":17,"stem":18,"__hash__":19,"stars":20,"downloads":20,"readme":21},"modules\u002Fmodules\u002Fapi.yml",[6],"Api","A lightweight, flexible HTTP\u002FWebSocket API module for AntelopeJS","https:\u002F\u002Fgithub.com\u002FAntelopeJS\u002Fapi","yml","\u002Ficons\u002Fantelope.svg",[12],"api",{},"@antelopejs\u002Fapi",true,"antelopejs\u002Fapi",false,"modules\u002Fapi","wqhPHzklyZcitb8BVbQFYYsj4lJIQmtGQ_vfnB5IW4E",null,{"data":22,"body":24,"toc":435},{"title":23,"description":23},"",{"type":25,"children":26},"root",[27,38,45,87,92,99,109,115,120,175,181,186,221,227,232,240,247,252,265,322,328,333,358,417,422],{"type":28,"tag":29,"props":30,"children":31},"element","p",{},[32],{"type":28,"tag":33,"props":34,"children":37},"img",{"alt":35,"src":36},"API","https:\u002F\u002Fraw.githubusercontent.com\u002Fantelopejs\u002Fapi\u002Fmain\u002F.github\u002Fsocial-card.png",[],{"type":28,"tag":39,"props":40,"children":42},"h2",{"id":41},"antelopejsapi",[43],{"type":44,"value":14},"text",{"type":28,"tag":46,"props":47,"children":49},"div",{"align":48},"center",[50,60,69,78],{"type":28,"tag":51,"props":52,"children":54},"a",{"href":53},"https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@antelopejs\u002Fapi",[55],{"type":28,"tag":33,"props":56,"children":59},{"alt":57,"src":58},"NPM version","https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002F@antelopejs\u002Fapi.svg?style=for-the-badge&labelColor=000000",[],{"type":28,"tag":51,"props":61,"children":63},{"href":62},".\u002FLICENSE",[64],{"type":28,"tag":33,"props":65,"children":68},{"alt":66,"src":67},"License","https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fl\u002F@antelopejs\u002Fapi.svg?style=for-the-badge&labelColor=000000",[],{"type":28,"tag":51,"props":70,"children":72},{"href":71},"https:\u002F\u002Fdiscord.gg\u002FsjK28QHrA7",[73],{"type":28,"tag":33,"props":74,"children":77},{"src":75,"alt":76},"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDiscord-18181B?logo=discord&style=for-the-badge&color=000000","Discord",[],{"type":28,"tag":51,"props":79,"children":81},{"href":80},"https:\u002F\u002Fantelopejs.com\u002Fmodules\u002Fapi",[82],{"type":28,"tag":33,"props":83,"children":86},{"src":84,"alt":85},"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDocs-18181B?style=for-the-badge&color=000000","Documentation",[],{"type":28,"tag":29,"props":88,"children":89},{},[90],{"type":44,"value":91},"A lightweight, flexible HTTP\u002FWebSocket API module that implements the interface API of antelopejs.",{"type":28,"tag":93,"props":94,"children":96},"h3",{"id":95},"installation",[97],{"type":44,"value":98},"Installation",{"type":28,"tag":100,"props":101,"children":102},"pre",{},[103],{"type":28,"tag":104,"props":105,"children":106},"code",{},[107],{"type":44,"value":108},"ajs project modules add @antelopejs\u002Fapi\n",{"type":28,"tag":93,"props":110,"children":112},{"id":111},"interfaces",[113],{"type":44,"value":114},"Interfaces",{"type":28,"tag":29,"props":116,"children":117},{},[118],{"type":44,"value":119},"This module implements the API interfaces who provide a HTTP framework with decorator controllers and middleware support. The interfaces are installed separately to maintain modularity and minimize dependencies.",{"type":28,"tag":121,"props":122,"children":123},"table",{},[124,146],{"type":28,"tag":125,"props":126,"children":127},"thead",{},[128],{"type":28,"tag":129,"props":130,"children":131},"tr",{},[132,138,143],{"type":28,"tag":133,"props":134,"children":135},"th",{},[136],{"type":44,"value":137},"Name",{"type":28,"tag":133,"props":139,"children":140},{},[141],{"type":44,"value":142},"Install command",{"type":28,"tag":133,"props":144,"children":145},{},[],{"type":28,"tag":147,"props":148,"children":149},"tbody",{},[150],{"type":28,"tag":129,"props":151,"children":152},{},[153,158,167],{"type":28,"tag":154,"props":155,"children":156},"td",{},[157],{"type":44,"value":35},{"type":28,"tag":154,"props":159,"children":160},{},[161],{"type":28,"tag":104,"props":162,"children":164},{"className":163},[],[165],{"type":44,"value":166},"ajs module imports add api",{"type":28,"tag":154,"props":168,"children":169},{},[170],{"type":28,"tag":51,"props":171,"children":173},{"href":172},"https:\u002F\u002Fgithub.com\u002FAntelopeJS\u002Finterface-api",[174],{"type":44,"value":85},{"type":28,"tag":93,"props":176,"children":178},{"id":177},"overview",[179],{"type":44,"value":180},"Overview",{"type":28,"tag":29,"props":182,"children":183},{},[184],{"type":44,"value":185},"The AntelopeJS API module provides a robust HTTP and WebSocket server implementation with a controller-based approach for building REST APIs and real-time applications. It supports:",{"type":28,"tag":187,"props":188,"children":189},"ul",{},[190,196,201,206,211,216],{"type":28,"tag":191,"props":192,"children":193},"li",{},[194],{"type":44,"value":195},"HTTP and HTTPS servers",{"type":28,"tag":191,"props":197,"children":198},{},[199],{"type":44,"value":200},"WebSocket connections",{"type":28,"tag":191,"props":202,"children":203},{},[204],{"type":44,"value":205},"Controller-based routing",{"type":28,"tag":191,"props":207,"children":208},{},[209],{"type":44,"value":210},"Parameter injection",{"type":28,"tag":191,"props":212,"children":213},{},[214],{"type":44,"value":215},"Middleware support",{"type":28,"tag":191,"props":217,"children":218},{},[219],{"type":44,"value":220},"CORS configuration",{"type":28,"tag":93,"props":222,"children":224},{"id":223},"configuration",[225],{"type":44,"value":226},"Configuration",{"type":28,"tag":29,"props":228,"children":229},{},[230],{"type":44,"value":231},"The API module can be configured with the following options:",{"type":28,"tag":100,"props":233,"children":234},{},[235],{"type":28,"tag":104,"props":236,"children":237},{},[238],{"type":44,"value":239},"{\n  \"servers\": [\n    {\n      \"protocol\": \"http\",\n      \"host\": \"localhost\",\n      \"port\": 8080\n    },\n    {\n      \"protocol\": \"https\",\n      \"host\": \"localhost\",\n      \"port\": 8443,\n      \"cert\": \"path-to-cert\",\n      \"key\": \"path-to-key\"\n    }\n  ],\n  \"cors\": {\n    \"allowedOrigins\": [\"https:\u002F\u002Fexample.com\", \"https:\u002F\u002Fapi.example.net\"],\n    \"allowedMethods\": [\"GET\", \"POST\", \"PUT\", \"DELETE\"]\n  }\n}\n",{"type":28,"tag":241,"props":242,"children":244},"h4",{"id":243},"server-configuration",[245],{"type":44,"value":246},"Server Configuration",{"type":28,"tag":29,"props":248,"children":249},{},[250],{"type":44,"value":251},"The module supports both HTTP and HTTPS servers. If no servers are configured, it defaults to HTTP on port 80.",{"type":28,"tag":29,"props":253,"children":254},{},[255,257,263],{"type":44,"value":256},"Each server in the ",{"type":28,"tag":104,"props":258,"children":260},{"className":259},[],[261],{"type":44,"value":262},"servers",{"type":44,"value":264}," array can have the following properties:",{"type":28,"tag":187,"props":266,"children":267},{},[268,279,290,301],{"type":28,"tag":191,"props":269,"children":270},{},[271,277],{"type":28,"tag":104,"props":272,"children":274},{"className":273},[],[275],{"type":44,"value":276},"protocol",{"type":44,"value":278},": Either \"http\" or \"https\"",{"type":28,"tag":191,"props":280,"children":281},{},[282,288],{"type":28,"tag":104,"props":283,"children":285},{"className":284},[],[286],{"type":44,"value":287},"host",{"type":44,"value":289},": (Optional) The hostname to bind to",{"type":28,"tag":191,"props":291,"children":292},{},[293,299],{"type":28,"tag":104,"props":294,"children":296},{"className":295},[],[297],{"type":44,"value":298},"port",{"type":44,"value":300},": (Optional) The port to listen on",{"type":28,"tag":191,"props":302,"children":303},{},[304,306,312,314,320],{"type":44,"value":305},"Additional properties from Node.js http.ServerOptions or https.ServerOptions, such as ",{"type":28,"tag":104,"props":307,"children":309},{"className":308},[],[310],{"type":44,"value":311},"cert",{"type":44,"value":313}," and ",{"type":28,"tag":104,"props":315,"children":317},{"className":316},[],[318],{"type":44,"value":319},"key",{"type":44,"value":321}," for HTTPS",{"type":28,"tag":241,"props":323,"children":325},{"id":324},"cors-configuration",[326],{"type":44,"value":327},"CORS Configuration",{"type":28,"tag":29,"props":329,"children":330},{},[331],{"type":44,"value":332},"The API module automatically adds a middleware for CORS support, which can be configured with:",{"type":28,"tag":187,"props":334,"children":335},{},[336,347],{"type":28,"tag":191,"props":337,"children":338},{},[339,345],{"type":28,"tag":104,"props":340,"children":342},{"className":341},[],[343],{"type":44,"value":344},"allowedOrigins",{"type":44,"value":346},": An array of allowed origins or regular expressions",{"type":28,"tag":191,"props":348,"children":349},{},[350,356],{"type":28,"tag":104,"props":351,"children":353},{"className":352},[],[354],{"type":44,"value":355},"allowedMethods",{"type":44,"value":357},": An array of allowed HTTP methods",{"type":28,"tag":29,"props":359,"children":360},{},[361,363,369,371,377,379,385,386,392,394,400,402,408,410,415],{"type":44,"value":362},"In development (when the runtime reports ",{"type":28,"tag":104,"props":364,"children":366},{"className":365},[],[367],{"type":44,"value":368},"dev",{"type":44,"value":370},"), loopback origins — ",{"type":28,"tag":104,"props":372,"children":374},{"className":373},[],[375],{"type":44,"value":376},"localhost",{"type":44,"value":378},", ",{"type":28,"tag":104,"props":380,"children":382},{"className":381},[],[383],{"type":44,"value":384},"127.0.0.1",{"type":44,"value":313},{"type":28,"tag":104,"props":387,"children":389},{"className":388},[],[390],{"type":44,"value":391},"[::1]",{"type":44,"value":393},", on any port — are accepted automatically, with or without a ",{"type":28,"tag":104,"props":395,"children":397},{"className":396},[],[398],{"type":44,"value":399},"cors",{"type":44,"value":401}," block, so local frontends need no configuration. The request origin is reflected as-is, never ",{"type":28,"tag":104,"props":403,"children":405},{"className":404},[],[406],{"type":44,"value":407},"*",{"type":44,"value":409},". In production, and for non-loopback development frontends (e.g. a LAN address), origins must be listed explicitly in ",{"type":28,"tag":104,"props":411,"children":413},{"className":412},[],[414],{"type":44,"value":344},{"type":44,"value":416},".",{"type":28,"tag":93,"props":418,"children":420},{"id":419},"license",[421],{"type":44,"value":66},{"type":28,"tag":29,"props":423,"children":424},{},[425,427,433],{"type":44,"value":426},"This project is licensed under the Apache License 2.0 - see the ",{"type":28,"tag":51,"props":428,"children":430},{"href":429},"https:\u002F\u002Fraw.githubusercontent.com\u002Fantelopejs\u002Fapi\u002Fmain\u002FLICENSE",[431],{"type":44,"value":432},"LICENSE",{"type":44,"value":434}," file for details.",{"title":23,"searchDepth":436,"depth":436,"links":437},3,[438],{"id":41,"depth":439,"text":14,"children":440},2,[441,442,443,444,449],{"id":95,"depth":436,"text":98},{"id":111,"depth":436,"text":114},{"id":177,"depth":436,"text":180},{"id":223,"depth":436,"text":226,"children":445},[446,448],{"id":243,"depth":447,"text":246},4,{"id":324,"depth":447,"text":327},{"id":419,"depth":436,"text":66},1788893231730]