API Docs for: 0.7.5
Show:

OutputHandler Class

This is an object used as the single pathway for data to leave a mojit action execution. It is used as a component of the ActionContext object, which uses it to call done and flush in order to complete.

There are two versions of this object, one for the client, and one for the server. This is the server version, which is more complex than the client version.

Constructor

OutputHandler

(
  • req
  • res
  • next
)

Parameters:

  • req Object

    The Request object.

  • res Object

    The Response object.

  • next Function

    The next function, which should be invokable.

Methods

_configureAppInstance

(
  • app
  • }
  • appConfig
)
private

Adds Mojito framework components to the Express application instance.

Parameters:

  • app Object

    The Express application instance to Mojito-enable.

  • } Port: number,!~YUIDOC_LINE~! dir: string,!~YUIDOC_LINE~! context: Object,!~YUIDOC_LINE~! appConfig: Object,!~YUIDOC_LINE~! verbose: boolean

    options An object containing server options.

  • appConfig Object

    The static application configuration.

_configureYUI

(
  • Y
  • store
)
Array private

Configures YUI with both the Mojito framework and all the YUI modules in the application.

Parameters:

  • Y Object

    YUI object to configure

  • store Object

    Resource Store which knows what to load

Returns:

Array: array of YUI module names

_createYUIInstance

(
  • options
  • appConfig
)
Object private

Creates the YUI instance.

Parameters:

  • options Object

    The options as passed to the constructor.

  • appConfig Object

    The static application configuration.

Returns:

Object: The YUI instances.

_makeMiddewareList

(
  • app_mw
  • mojito_mw
)
Array private

A utility function for compiling a list of middleware

Parameters:

  • app_mw Array

    Middleware list specified by the app's applicatioon.json

  • mojito_mw Array

    Middeware list specified Mojito, in this file, by the MojitoServer.MOJITO_MIDDLEWARE property

Returns:

Array: Complete and ordered list of middleware to load

_renderChild

(
  • ac
  • callback
)
protected

Renders a child mojit based on a config called "child" and the "assets" collection specified in the specs.

Parameters:

  • ac Object

    Action Context Object.

  • callback Function

    The callback.

_useMiddleware

(
  • app
  • dispatcher
  • midDir
  • midConfig
  • middleware
)
private

A utility function to require middleware code, configure it, and tell express to use() it.

Parameters:

  • app Object

    Express app instance.

  • dispatcher Function

    Dispatcher function wrapper, special case middleware.

  • midDir String

    Directory of user-specified middleware, if any.

  • midConfig Object

    Configuration object.

  • middleware Array

    Middleware names, or pathnames.

createServer

(
  • options
)
Object

Creates a properly configured MojitoServer instance and returns it.

Parameters:

  • options Object

    Options for starting the app.

Returns:

Object: Express application.

include

(
  • path
)
Object

Allows the bin/mojito command to leverage the current module's relative path for initial startup loading.

Parameters:

  • path String

    The path used to locate resources.

Returns:

Object: The return value of require() for the adjusted path.