MojitoServer Class
The Mojito Server bootstrap
Item Index
Methods
_matchToInternal
-
uri -
verb.
Returns a matching route for the given URI
Parameters:
-
uriStringThe uri to find a route for.
-
verb.StringThe 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:
-
appObjectExpress application.
-
optionsObjectThe directory to start the application in.
createServer
-
options
Creates an Express application with the Mojito framework already added.
Parameters:
-
optionsObjectOptions for starting the app.
Returns:
find
-
url -
verb
Finds a route for a given method+URL
Parameters:
-
urlStringthe URL to find a route for.
-
verbStringthe 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:
getInlineCssMojits
-
store -
env -
context
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:
-
storeStringresource store
-
envString"client" or "server"
-
contextObjectruntime context
Returns:
MakeStore
-
cfg
Creates the Resource Store object.
Parameters:
-
cfgObjectConfiguration for the resource store.
Returns:
mergeRecursive
-
dest -
src -
typeMatch
Recursively merge properties of two objects
Parameters:
-
destObjectThe destination object.
-
srcObjectThe source object.
-
typeMatchBooleanOnly replace if src and dest types are the same type if true.
metaMerge
-
to -
from -
clobber
Used to merge meta objects into each other. Special consideration for certain headers values like 'content-type'.
Parameters:
-
toObjectThe target object.
-
fromObjectThe source object.
-
clobberBooleanTrue to overwrite existing properties.
