Skip to the content.

Classes

Application

Expose Application class. Inherits from Koa.

RouterGroup

Application

Expose Application class. Inherits from Koa.

Kind: global class

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

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