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