RingoJS

Module stick

The stick module provides the Application class which is the centerpiece of the Stick framework.

A Stick Application is a JSGI application which provides means to compose complex applications out of modular middleware components.

Class Application

Instance Methods

Instance Properties



Application.prototype. base

This application's base URI path as used by the current request, or null if unknown.


Application.prototype. configure (middleware...)

Apply one or more middleware factories to this Application. Middleware will be wrapped around the existing middleware chain, starting with the rightmost argument. For example, the following invocation of configure on a newly created Application object:

app.configure("error", "route");

will result in error(route(unhandled())) as middleware chain.

Parameters

null middleware...

one or middleware factories. These can be defined as module names, imported modules, or middleware factories. For the middleware that is part of Stick it is sufficient to use the last part of the module id. e.g. "error" or "route".


Application.prototype. env (name)

Returns an Application object that shares the middleware chain of the original application, but can be configured to contain additional middleware that is not shared with the parent application.

Repeated calls of the env method with the same argument return the same application object.

Parameters

string name

the environment name


Application.prototype. request

The request object associated with the current thread, or null.