API Docs for:
Show:

MojitoServer Class

The Mojito Server bootstrap

Methods

_matchToInternal

(
  • uri
  • verb.
)
private

Returns a matching route for the given URI

Parameters:

  • uri String

    The uri to find a route for.

  • verb. String

    The HTTP verb for the route.

addMojitoToExpressApp

(
  • app
  • options
)

Adds the Mojito framework to the Express application.

You only need to call one of addMojitoToExpressApp() or createServer(). If you want to create your own Express app do that then use addMojitoToExpressApp(). Otherwise Mojito can create an app for you if you use createServer().

Parameters:

  • app Object

    Express application.

  • options Object

    The directory to start the application in.

createServer

(
  • options
)
Object

Creates an Express application with the Mojito framework already added.

Parameters:

  • options Object

    Options for starting the app.

Returns:

Object: Express application.

find

(
  • url
  • verb
)

Finds a route for a given method+URL

Parameters:

  • url String

    the URL to find a route for.

  • verb String

    the HTTP method.

getComputedRoutes

() Object

For optimization. Call this to get the computed routes that can be passed to the constructor to avoid recomputing the routes.

Returns:

Object: computed routes.

getInlineCssMojits

(
  • store
  • env
  • context
)
Array

Returns details on how to make inline CSS for mojits.

This example comes from (a modified) GSG5. [ { mojitName: 'FlickrDetail', yuiModuleName: 'inlinecss/FlickrDetail', dest: '/blah/mojits/FlickrDetail/autoload/compiled' + '/css.iphone.client.js', srcs: { '/static/FlickrDetail/assets/index.css': true, '/static/FlickrDetail/assets/message.css': true } ]

Parameters:

  • store String

    resource store

  • env String

    "client" or "server"

  • context Object

    runtime context

Returns:

Array: object describing where to put the inline CSS file and what it should contain

MakeStore

(
  • cfg
)
ResourceStore private

Creates the Resource Store object.

Parameters:

  • cfg Object

    Configuration for the resource store.

Returns:

ResourceStore: the new resource store object

mergeRecursive

(
  • dest
  • src
  • typeMatch
)

Recursively merge properties of two objects

Parameters:

  • dest Object

    The destination object.

  • src Object

    The source object.

  • typeMatch Boolean

    Only replace if src and dest types are the same type if true.

metaMerge

(
  • to
  • from
  • clobber
)
private

Used to merge meta objects into each other. Special consideration for certain headers values like 'content-type'.

Parameters:

  • to Object

    The target object.

  • from Object

    The source object.

  • clobber Boolean

    True to overwrite existing properties.