- Application
Expose
Application
class. Inherits fromKoa
.- RouterGroup
Expose Application
class.
Inherits from Koa
.
Kind: global class
- Application
- new Application([options])
- .GET|PUT|POST|PATCH|DELETE|DEL|ALL ⇒
RouterGroup
- .USE
- .get|put|post|patch|delete|del|all ⇒
RouterGroup
- .use(fn)
- .Listen()
- .listen(...args)
- .listenTLS(options, ...args)
- .group(prefix) ⇒
RouterGroup
- .parse(any) ⇒
[ 'Array' ].<String>
- .bindClass(name, instance)
- .bindFunction(name, instance)
- .bindAny(name, instance)
- .getInstance(name) ⇒
*
- .getInstances(names) ⇒
Array
- .getInstancesMap(names) ⇒
Object
- .deleteInstance(name)
- .deleteInstances(names)
- .reset()
Initialize a new Application
.
Inherits from Koa
.
Param | Type | Default | Description |
---|---|---|---|
[options] | Object |
Application options. | |
[options.env] | String |
'development' |
Environment |
[options.keys] | [ 'Array' ].<String> |
Signed cookie keys | |
[options.proxy] | Boolean |
Trust proxy headers | |
[options.subdomainOffset] | Number |
Subdomain offset | |
[options.proxyIpHeader] | Boolean |
proxy ip header, default to X-Forwarded-For | |
[options.maxIpsCount] | Boolean |
max ips read from proxy ip header, default to 0 (means infinity) | |
[options.prefix] | String |
prefix router paths |
application.GET|PUT|POST|PATCH|DELETE|DEL|ALL ⇒ RouterGroup
Alias for koa-router verbs methods.
Kind: instance property of Application
Param | Type | Description |
---|---|---|
path | String |
|
[middleware] | function |
route middleware(s) |
callback | function |
route callback |
Alias for koa use()
.
Kind: instance property of Application
Param | Type |
---|---|
fn | function |
application.get|put|post|patch|delete|del|all ⇒ RouterGroup
Create router verbs methods, where verb is one of the HTTP verbs such
as app.get()
or app.post()
.
Kind: instance property of Application
Param | Type | Description |
---|---|---|
path | String |
|
[middleware] | function |
route middleware(s) |
callback | function |
route callback |
Register application level middleware.
Kind: instance method of Application
Access: public
Param | Type | Description |
---|---|---|
fn | function |
middleware |
Alias for: Koa app.listen()
Kind: instance method of Application
Access: public
Overwrite Koa app.listen()
Kind: instance method of Application
Access: public
Param | Type | Description |
---|---|---|
...args | Mixed |
... |
Shorthand for: https.createServer(options, app.callback()).listen(...)
Kind: instance method of Application
Access: public
Param | Type | Description |
---|---|---|
options | Object |
|
...args | Mixed |
... |
application.group(prefix) ⇒ RouterGroup
Group router.
Kind: instance method of Application
Access: public
Param | Type | Description |
---|---|---|
prefix | String |
prefix router paths |
Parse function|class parameters.
Kind: instance method of Application
Access: public
Param | Type |
---|---|
any | Class | function |
Bind Class.
Kind: instance method of Application
Access: public
Param | Type | Description |
---|---|---|
name | String |
The name of the injected class. |
instance | Class |
Injected class. |
singleton. | Boolean |
Bind function.
Kind: instance method of Application
Access: public
Param | Type | Description |
---|---|---|
name | String |
The name of the injected function. |
instance | function |
Injected function. |
singleton. | Boolean |
Bind Any.
Kind: instance method of Application
Access: public
Param | Type | Description |
---|---|---|
name | String |
The name of the injected function. |
instance | * |
Injected instance. |
singleton. | Boolean |
Get Instance.
Kind: instance method of Application
Returns: *
- - instance.
Access: public
Param | Type | Description |
---|---|---|
name | String |
The name of the injected instance. |
Get Instances.
Kind: instance method of Application
Returns: Array
- - instances.
Access: public
Param | Type | Description |
---|---|---|
names | [ 'Array' ].<String> |
The names of the injected instances. |
Get Instances map.
Kind: instance method of Application
Returns: Object
- - instances.
Access: public
Param | Type | Description |
---|---|---|
names | [ 'Array' ].<String> |
The names of the injected instances. |
Delete Instance.
Kind: instance method of Application
Access: public
Param | Type | Description |
---|---|---|
name | String |
The name of the injected instance. |
Delete Instances.
Kind: instance method of Application
Access: public
Param | Type | Description |
---|---|---|
names | [ 'Array' ].<String> |
The names of the injected instances. |
Reset instance pool.
Kind: instance method of Application
Access: public
Kind: global class
Access: public
Initialize a new RouterGroup
.
Inherits from koa-router
.
Param | Type | Description |
---|---|---|
[options] | Object |
Application options. |
[options.prefix] | String |
prefix router paths. |
app | Application |
routerGroup.GET|PUT|POST|PATCH|DELETE|DEL|ALL ⇒ RouterGroup
Alias for koa-router verbs methods.
Kind: instance property of RouterGroup
Param | Type | Description |
---|---|---|
path | String |
|
[middleware] | function |
route middleware(s) |
callback | function |
route callback |
routerGroup.USE ⇒ RouterGroup
Alias for koa-router use()
.
Kind: instance property of RouterGroup
Param | Type |
---|---|
[path] | String |
middleware | function |
[...] | function |
routerGroup.get|put|post|patch|delete|del|all ⇒ RouterGroup
Overwrite all router verbs methods of Router
.
Kind: instance property of RouterGroup
Param | Type | Description |
---|---|---|
path | String |
|
[middleware] | function |
route middleware(s) |
callback | function |
route callback |
routerGroup.use(fn) ⇒ RouterGroup
Overwrite use.
Kind: instance method of RouterGroup
Access: public
Param | Type |
---|---|
fn | function |