Classes
- Application
Expose
Application
class. Inherits fromKoa
.- RouterGroup
Application
Expose Application
class.
Inherits from Koa
.
Kind: global class
- Application
- new Application([options])
-
[.GET PUT POST PATCH DELETE DEL ALL](#Application+GET PUT POST PATCH DELETE DEL ALL) ⇒ RouterGroup
- .USE
-
[.get put post patch delete del all](#Application+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()
new Application([options])
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 |
application.USE
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 |
application.use(fn)
Register application level middleware.
Kind: instance method of Application
Access: public
Param | Type | Description |
---|---|---|
fn | function |
middleware |
application.Listen()
Alias for: Koa app.listen()
Kind: instance method of Application
Access: public
application.listen(…args)
Overwrite Koa app.listen()
Kind: instance method of Application
Access: public
Param | Type | Description |
---|---|---|
…args | Mixed |
… |
application.listenTLS(options, …args)
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 |
application.parse(any) ⇒ [ 'Array' ].<String>
Parse function|class parameters.
Kind: instance method of Application
Access: public
Param | Type |
---|---|
any | Class | function |
application.bindClass(name, instance)
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 |
application.bindFunction(name, instance)
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 |
application.bindAny(name, instance)
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 |
application.getInstance(name) ⇒ \*
Get Instance.
Kind: instance method of Application
Returns: \*
- - instance.
Access: public
Param | Type | Description |
---|---|---|
name | String |
The name of the injected instance. |
application.getInstances(names) ⇒ Array
Get Instances.
Kind: instance method of Application
Returns: Array
- - instances.
Access: public
Param | Type | Description |
---|---|---|
names | [ 'Array' ].<String> |
The names of the injected instances. |
application.getInstancesMap(names) ⇒ Object
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. |
application.deleteInstance(name)
Delete Instance.
Kind: instance method of Application
Access: public
Param | Type | Description |
---|---|---|
name | String |
The name of the injected instance. |
application.deleteInstances(names)
Delete Instances.
Kind: instance method of Application
Access: public
Param | Type | Description |
---|---|---|
names | [ 'Array' ].<String> |
The names of the injected instances. |
application.reset()
Reset instance pool.
Kind: instance method of Application
Access: public
RouterGroup
Kind: global class
Access: public
- RouterGroup
- new RouterGroup([options], app)
-
[.GET PUT POST PATCH DELETE DEL ALL](#RouterGroup+GET PUT POST PATCH DELETE DEL ALL) ⇒ RouterGroup
- .USE ⇒
RouterGroup
-
[.get put post patch delete del all](#RouterGroup+get put post patch delete del all) ⇒ RouterGroup
- .use(fn) ⇒
RouterGroup
new RouterGroup([options], app)
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 |