- Controller YUI module name should be same as directory (i.e; same name as Mojit)
addon
namespace should match the filename. E.g.ac.foo
corresponds toaddons/ac/foo.common.js
.
Last active
December 11, 2015 08:08
-
-
Save saich/4570725 to your computer and use it in GitHub Desktop.
Useful links for Yahoo! Mojito
Applicable atleast to Yahoo! Mojito v0.5.3-1.
- Middlewares are declared in the application.json.
- The way the middleware works depends on the file name of the middleware.
- If file name starts with mojito- (e.g:
mojito-logger.js
):- The exported function should return a function, that can be called with express's app.use. For example, you can return
express.logger()
and the framework shall callapp.use(express.logger())
using this return value. - This approach is suitable to use
app.use
, since the express's app is not exposed in the Mojito framework. - The configuration received by this function is of form:
{ Y: Y, store: store, logger: { log: Y.log }, context: options.context }
- Tip: You can use
require('mojito/node_modules/express')
to use express from Mojito's dependencies, instead of adding a direct dependency on express in yourpackage.json
.
- The exported function should return a function, that can be called with express's app.use. For example, you can return
- For all other files, it acts like a normal express middleware, which is called for every request with the express's request, response and next parameters, and should call
next()
to pass control to other middleware.
References:
- Yahoo! Scale Node.js (Dynamic Configuraton using YQL Storage - Change application behavior without redeployment, Need for private npm)
- Official Additional Resources & Wiki Home on GitHub- Contains a list of some presentations and screencasts.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment