developer

Mojito Quickstart

Requirements

System: Unix-based system.

Software: Node.js (>= 0.8.0 <0.11), npm (> 1.0.0)

Installation Steps

  1. Globally install the Mojito CLI package v0.2.x (mojito-cli) from the npm registry so that you can run Mojito commands. You may need to use sudo if you run into permission errors.

    $ npm install mojito-cli@~0.2.0 -g

  2. Do the same for the Mojito CLI utility for creating applications and mojits (mojito-cli-create):

    $ npm install mojito-cli-create@0~0.1.1 -g

  3. 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:

    $ node app.js

  2. Go to http://localhost:8666/@myMojit/index to see your application. You’ll also find the Mojito documentation and instructions for creating the quickstartguide application.

  3. Stop your application by pressing Ctrl-C.

For a more in-depth tutorial, please see Tutorial: Creating Your First Application. To learn more about Mojito, see the Mojito Documentation.