Config route myMojit - 1950195/simple-mojito GitHub Wiki
编辑文件: mojits/myMojit/controller.server.js
YUI.add('myMojit', function(Y, NAME) {
Y.namespace('mojito.controllers')[NAME] = {
index: function(ac) {
ac.done('Hello, world. I have created my first Mojito app at ' + (new Date()) + '.');
},
another: function(ac) {
ac.done('mojito.controllers.myMojit.another');
}
};
}, '0.0.1', {requires: ['mojito']});
编辑文件: routes.json
[
{
"settings": [ "master" ],
"my": {
"verbs": ["get"],
"path": "/my",
"call": "my.index"
},
"my/another": {
"verbs": ["get"],
"path": "/my/another",
"call": "my.another"
}
}
]
启动 mojito
$ mojito start
打开浏览器,输入网址: http://localhost:8666/@myMojit/index