UNPKG

@goa/goa

Version:

The Goa Source Code For Compilation Into @Goa/Koa That Includes Modules, Tests, Types And Dependencies.

105 lines (100 loc) 4.33 kB
<types namespace="_goa"> <import from="http" name="IncomingMessage" /> <import from="http" name="ServerResponse" /> <import from="http" name="Server" /> <import from="events" name="EventEmitter" /> <!-- The .. are required in types JS files to correctly link together. --> <import from=".." ns="_goa" name="Keygrip" /> <import from=".." ns="_goa" name="Context" /> <import from=".." ns="_goa" name="Request" /> <import from=".." ns="_goa" name="Response" /> <interface extends="events.EventEmitter" name="Application" desc="The application interface."> <fn name="constructor"> <arg type="_goa.ApplicationOptions" name="options" opt> Options to create an application. </arg> Creates a new app instance. </fn> <prop opt boolean name="proxy" initial="false"> Whether the server is running behind a proxy. </prop> <prop type="!Array<!_goa.Middleware>" name="middleware" initial="[]"> The array with middleware used on the server. </prop> <prop type="!_goa.Context" name="context"> The context object for each request. </prop> <prop type="!_goa.Request" name="request"> The request object for each request. </prop> <prop type="!_goa.Response" name="response"> The response object for each request. </prop> <prop string name="env" default="development"> The value from the `NODE_ENV` environment variable. </prop> <prop opt type="!(_goa.Keygrip|Array<string>)" name="keys"> The keys for signing of the cookies. </prop> <prop boolean name="silent" default="false"> Whether to not log an error when it happens. </prop> <fn name="listen" return="!http.Server" template-no-return> <arg name="...args">The arguments as [described](https://nodejs.org/api/net.html#net_server_listen).</arg> Shorthand for: `http.createServer(app.callback()).listen(...)`. </fn> <fn name="use" return="!_goa.Application"> <arg type="!_goa.Middleware" name="middleware">The middleware to install.</arg> Use the given middleware `fn`. Old-style middleware will be converted. </fn> <fn return="function(!http.IncomingMessage, !http.ServerResponse)" name="callback"> Returns the request handler callback for Node's native _http/http2_ server composed of the installed middleware. </fn> <fn name="createContext" return="!_goa.Context"> <arg type="!http.IncomingMessage" name="req"> The request object. </arg> <arg type="!http.ServerResponse" name="res"> The response object. </arg> `@private` Initialize a new context. </fn> <fn name="onerror"> <arg type="!Error" name="error">The error.</arg> `@private` Default error handler. </fn> <fn name="toJSON" return="!Object" template-no-return> Return JSON representation. </fn> <fn name="inspect" return="!Object" template-no-return> `util.inspect()` implementation, which just returns the JSON output. </fn> <prop opt number name="subdomainOffset" initial="2"> For example, if the domain is _tobi.ferrets.example.com_: - if `app.subdomainOffset` is not set, request.subdomains is `["ferrets", "tobi"]`. - if `app.subdomainOffset` is 3, request.subdomains is `["tobi"]`. </prop> </interface> <record name="ApplicationOptions" desc="Options for the application constructor."> <prop boolean name="proxy" default="false" opt> Whether the app should start in a proxy mode. </prop> <prop number name="subdomainOffset" default="2" opt> The offset for subdomains. </prop> <prop string name="env" opt> App environment. The default is `process.env.NODE_ENV || 'development'`. </prop> <prop type="!(_goa.Keygrip|Array<string>)" name="keys" opt> The keys for cookies, or a _Keygrip_ instance. </prop> <prop type="function(new: _goa.Context)" name="Context" opt> The custom context constructor. </prop> </record> <method name="Middleware" return="(!Promise|void)"> <arg type="!_goa.Context" name="ctx">The context.</arg> <arg type="!Function" name="next" opt>The callback.</arg> The function to handle requests which can be installed with the `.use` method. </method> </types>