Hide
Search Results

Mojito Quickstart

Requirements

System: Unix-based system.

Software: Node.js (>= 0.6.0 < 0.9.0), npm (> 1.0.0)

Installation Steps

  1. Get Mojito from the npm registry and globally install Mojito so that it can be run from the command line. You may need to use sudo if you run into permission errors.

    $ npm install mojito -g

  2. Confirm that Mojito has been installed by running the help command.

    $ mojito help

Create a Mojito Application

  1. $ mojito create app hello_world
  2. $ cd hello_world
  3. $ mojito create mojit myMojit

Modify Your Application

To make the application return a string we want, replace the code in mojits/myMojit/controller.server.js with the following:

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()) + '.');
      }

  };
});

Running the Application

  1. From the hello_world application directory, start Mojito:

    $ mojito start

  2. Go to http://localhost:8666/@myMojit/index to see your application.

  3. Stop your application by pressing Ctrl-C.

For a more in-depth tutorial, please see Mojito: Getting Started. To learn more about Mojito, see the Mojito Documentation.