Constructor Summary
Public Constructor | ||
public |
constructor(rootPath: String) |
Member Summary
Public Members | ||
public |
body: * |
|
public |
cache: * |
|
public |
config: * |
|
public |
context: * |
|
public |
engines: * |
|
public |
env: * |
|
public |
|
|
public |
|
|
public get |
logger: winston.Logger: * The app `logger`
|
|
public |
|
|
public get |
Get the app prefix path
|
|
public get |
The `config.paths` delegation
|
|
public get |
The app working `rootPath` directory
|
|
public set |
Set a working `rootPath` directory for app
|
|
public get |
routeMapper: RouteMapper: * Get route mapper.
|
|
public |
router: * |
|
public |
server: * |
|
public get |
Get all servides
|
|
public |
state: * |
Method Summary
Public Methods | ||
public |
all(path: String, handler: GeneratorFunction[]): Engine Special-cased "all" method, applying the given route `path`,
middleware, and handler to _every_ HTTP method.
|
|
public |
* bootstrap(): void Boot the app
|
|
public |
engine(ext: String, fn: GeneratorFunction): Engine Register the given template engine callback `fn` * as `ext`.
|
|
public |
Serves the default favicon - GET /favicon.ico
|
|
public |
getService(key: String): * Get a service by key
|
|
public |
Index serves index file
|
|
public |
* loadServices(): void Load services
|
|
public |
match(methods: String[], path: String, handler: GeneratorFunction[]): Engine Match adds a route > handler to the router for multiple HTTP methods provided
|
|
public |
Render `view` with the given `options`
|
|
public |
Run the app
|
|
public |
Serves files from a directory
|
|
public |
Serves a file
|
|
public |
Stores the `value` with `key` into `app.config`
|
|
public |
setService(key: String, service: *): void Stores a service
|
|
public |
Serves static files from a directory.
|
Public Constructors
Public Members
public body: * source
public cache: * source
public config: * source
public context: * source
public engines: * source
public env: * source
public router: * source
public server: * source
public get services: Map: * source
Get all servides
Example:
app.services
// return a `Map` object
// => map
public state: * source
Public Methods
public all(path: String, handler: GeneratorFunction[]): Engine source
Special-cased "all" method, applying the given route path
,
middleware, and handler to every HTTP method.
Params:
Name | Type | Attribute | Description |
path | String | ||
handler | GeneratorFunction[] |
public engine(ext: String, fn: GeneratorFunction): Engine source
Register the given template engine callback fn
* as ext
.
Params:
Name | Type | Attribute | Description |
ext | String | ||
fn | GeneratorFunction |
public favicon(file: String): Engine source
Serves the default favicon - GET /favicon.ico
Params:
Name | Type | Attribute | Description |
file | String |
Example:
app.favicon('public/favicon.ico')
public getService(key: String): * source
Get a service by key
Params:
Name | Type | Attribute | Description |
key | String |
Return:
* | service |
Example:
app.getService('db')
// => db
public match(methods: String[], path: String, handler: GeneratorFunction[]): Engine source
Match adds a route > handler to the router for multiple HTTP methods provided
Params:
Name | Type | Attribute | Description |
methods | String[] | ||
path | String | ||
handler | GeneratorFunction[] |
public * render(view: String, options: Object): String source
Render view
with the given options
Example:
yield app.render('site', { name: 'trek' })
public serveDir(path: String, dir: String, options: Object): Engine source
Serves files from a directory
public set(key: *, value: *): Engine source
Stores the value
with key
into app.config
Params:
Name | Type | Attribute | Description |
key | * | ||
value | * |