-
Notifications
You must be signed in to change notification settings - Fork 0
Application
Anton edited this page Jul 22, 2019
·
39 revisions
The application is the instance created by the Goa class. It can provide the callback listener via the callback
method, as well as start listening for connections itself. Application extends the EventEmitter class, so it's possible to listen on events, e.g.,
app.on('error', (err) => {
// handle error
})
_goa.Application
extends events.EventEmitter
: The application interface.
Name | Type & Description | Default |
---|---|---|
proxy |
boolean Whether the server is running behind a proxy. |
- |
middleware* |
!Array<!_goa.Middleware> The array with middleware used on the server. |
- |
context* |
!_goa.Context The context object for each request. |
- |
request* |
!_goa.Request The request object for each request. |
- |
response* |
!_goa.Response The response object for each request. |
- |
env |
string The value from the NODE_ENV environment variable. |
development |
keys |
!(_goa.Keygrip | Array<string>) The keys for signing of the cookies. |
- |
silent |
boolean Whether to not log an error when it happens. |
false |
listen* |
function() Shorthand for: http.createServer(app.callback()).listen(...)
|
- |
use* |
function(!_goa.Middleware): !_goa.Application Use the given middleware fn . Old-style middleware will be converted. |
- |
callback* |
function(): function(!http.IncomingMessage, !http.ServerResponse) Returns the request handler callback for node's native http/http2 server composed of the installed middleware. |
- |
createContext* |
function(!http.IncomingMessage, !http.ServerResponse)@private Initialize a new context. |
- |
onerror* |
function(!Error)@private Default error handler. |
- |
subdomainOffset |
number 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"] . |
- |
function(!_goa.Context, !Function): *
_goa.Middleware
: The function to handle requests which can be installed with the .use
method.