public
Created

Using mojito-session-addon example

  • Download Gist
controller.server.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
/*jslint anon:true, sloppy:true, nomen:true*/
YUI.add('home', function(Y, NAME) {
 
/**
* The home module.
*
* @module home
*/
 
/**
* Constructor for the Controller class.
*
* @class Controller
* @constructor
*/
Y.namespace('mojito.controllers')[NAME] = {
 
/**
* Method corresponding to the 'index' action.
*
* @param ac {Object} The ActionContext that provides access
* to the Mojito API.
*/
index : function(ac) {
ac.session.set("test", "test123");
Y.log(ac.session.get("test"));
ac.models.get('homeModelFoo').getData(function(err, data) {
if (err) {
ac.error(err);
return;
}
ac.assets.addCss('./index.css');
ac.done({
status : 'Mojito is working.',
data : data
});
});
 
}
};
 
}, '0.0.1', {
requires : ['mojito', 'mojito-assets-addon', 'mojito-models-addon', 'homeModelFoo', "mojito-session-addon"]
});

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.