App
Constructor Summary
Public Constructor | ||
public |
|
Method Summary
Public Methods | ||
public |
addMiddleware(middleware: function[]): adds the provided function to the list of Koa middlewares to be executed for all routes. |
|
public |
addMiddlewares(middlewares: function): adds the provided functions to the list of Koa middlewares to be executed for all routes. |
|
public |
mountFolder(pathFolder: string, prefix: string): "mounts" a folder, scanning it for route files, then adding the discovered routes to the app. |
|
public |
Launches the app and starts listening on the configured port. |
Public Constructors
public constructor() source
Public Methods
public addMiddleware(middleware: function[]): source
adds the provided function to the list of Koa middlewares to be executed for all routes.
Params:
Name | Type | Attribute | Description |
middleware | function[] | an array of middlewares |
Return:
public addMiddlewares(middlewares: function): source
adds the provided functions to the list of Koa middlewares to be executed for all routes.
Params:
Name | Type | Attribute | Description |
middlewares | function | an array of Koa-compliant middlewares |
Return:
public mountFolder(pathFolder: string, prefix: string): source
"mounts" a folder, scanning it for route files, then adding the discovered routes to the app. a route is a class which extends Route
Params:
Name | Type | Attribute | Description |
pathFolder | string | the path of the folder to mount |
|
prefix | string |
|
an optional prefix to prepend to all of the folder's routes |