Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Phobos simple controller (javascript on the server side) (See related posts)

Phobos simple controller

/*
 * Main controller for the application.
 *
 */

// define a controller module called "main"
library.common.define(controller, "main", function() {
    
    // controller class (constructor)
    function Main() {
        // insert instance initialization code here
    }
    
    // "show" action method
    Main.prototype.show = function() {
        
        /*
         Use the model global variable to pass information to the view.
         Alternatively, a view can access the controller instance by
         using the expression:
             invocation.controller
         */
        model = {};

        // render the /application/view/main.ejs view
        library.view.render("main.ejs");
    }
        
    /*
    // This method serves all requests for actions for which there
    // is no more specific method - please uncomment and modify as needed.
    // If this method is not defined, the default behavior is to return
    // a "404 Not Found" error
    Main.prototype.onRequest = function() {
        // return a 404 error
        library.httpserver.sendNotFound();
    };
    */
    
    // export the controller class
    this.Main = Main;
});


You need to create an account or log in to post comments to this site.


Click here to browse all 4863 code snippets

Related Posts