Create a new folder myapp/controllers.

Create a new file and call it myapp/controllers/main-controllers.js.

And launch the application with

new Controller('hello', {
    "execute": function(params, context) {
        return function(cb) {
            cb("My first test!");
        }
    }
});

it will output now

My first test!

If you have created a view and/or a layout, you can use context.view_name = 'ViewName' and context.layout_name = 'LayoutName' to wrap the response of the controller into the view and then wrap the views response into the layout.

Comments