Documentation generator: JsDoc Toolkit 2.4.0
Template: Codeview 1.2
Generated on: 2011-10-17 21:14

Class controller.BaseController

Class Summary
Constructor Attributes Constructor Name and Description
 
Field Summary
Field Attributes Field Name and Description
 
Actions to be performed after rendering a repsonse.
 
Actions to be performed before rendering a repsonse.
 
Content to use for the response.
 
Content-type of the response -- a result of the content-negotiation process.
 
Cookies collection for the request
 
Determined by what format the client requests, and if the controller/action supports it.
 
The name of the controller constructor function, in CamelCase with uppercase initial letter.
 
The parsed params for the request.
 
The raw http.ServerRequest object for this request/response cycle.
 
Content-type the controller can respond with.
 
The raw http.ServerResponse object for this request/response cycle.

Method Summary

Method Attributes Method Name and Description
 
after(filter, [opts])
Adds an action to the afterFilters list of actions to be performed after a response is rendered.
 
before(filter, [opts])
Adds an action to the beforeFilters list.
 
error(err)
Respond to a request with an appropriate HTTP error-code.
 
redirect(target)
Sends a 302 redirect to the client, based on either a simple string-URL, or a controller/action/format combination.
 
respond(content, [opts])
Performs content-negotiation, and renders a response.
 
transfer(action)
Transfer a request from its original action to a new one.

Class Detail

controller.BaseController()

Field Detail

afterFilters
Actions to be performed after rendering a repsonse.
beforeFilters
Actions to be performed before rendering a repsonse.
content
Content to use for the response.
contentType
Content-type of the response -- a result of the content-negotiation process. Determined by the format, and by what content-types the client accepts.
{Object} cookies
Cookies collection for the request
format
Determined by what format the client requests, and if the controller/action supports it. Built-in formats can be found in the enum controller.formats
{String} name
The name of the controller constructor function, in CamelCase with uppercase initial letter.
{Object} params
The parsed params for the request. Also passed as an arg to the action, added as an instance field for convenience.
{http.ServerRequest} request
The raw http.ServerRequest object for this request/response cycle.
{Array} respondsWith
Content-type the controller can respond with.
Default Value:
['txt']
{http.ServerResponse} response
The raw http.ServerResponse object for this request/response cycle.

Method Detail

  • after(filter, [opts])
    Adds an action to the afterFilters list of actions to be performed after a response is rendered.
    Parameters:
    {Function} filter
    Action to add to the afterFilter list.
    {Object} opts Optional
    {Array} opts.except Optional, Default: null
    List of actions where the after-filter should not be performed.
    {Array} opts.only Optional, Default: null
    This list of actions are the only actions where this after-filter should be performed.
  • before(filter, [opts])
    Adds an action to the beforeFilters list.
    Parameters:
    {Function} filter
    Action to add to the beforeFilter list of actions to be performed before a response is rendered.
    {Object} opts Optional
    {Array} opts.except Optional, Default: null
    List of actions where the before-filter should not be performed.
    {Array} opts.only Optional, Default: null
    This list of actions are the only actions where this before-filter should be performed.
  • error(err)
    Respond to a request with an appropriate HTTP error-code. If a status-code is set on the error object, uses that as the error's status-code. Otherwise, responds with a 500 for the status-code.
    Parameters:
    {Object} err
    The error to use as the basis for the response.
  • redirect(target)
    Sends a 302 redirect to the client, based on either a simple string-URL, or a controller/action/format combination.
    Parameters:
    {String|Object} target
    Either an URL, or an object literal containing controller/action/format attributes to base the redirect on.
  • respond(content, [opts])
    Performs content-negotiation, and renders a response.
    Parameters:
    {Object|String} content
    The content to use in the response.
    {Object} opts Optional
    Options.
    {String} opts.format Optional
    The desired format for the response.
    {String} opts.template Optional
    The path (without file extensions) to the template to use to render this response.
    {String} opts.layout Optional
    The path (without file extensions) to the layout to use to render the template for this response.
  • transfer(action)
    Transfer a request from its original action to a new one. The entire request cycle is repeated, including before-filters.
    Parameters:
    {Object} action
    The new action designated to handle the request.