Back to Library

Devlopment Running RingoJs App

A ringojs application has abuilt in jetty runner, it can be run:

  • From the command line
$ bin/ringo apps/demo/main.js
  • or in eclipse

 Running Ringojs in Eclipse

RingoJs MVC

RingoJS, URL mapping

Tweak the URL routing or middleware stack in config.js.
Edit and add actions in actions.js.
Adapt the templates in the skins directory

Maybe the single most important productivity feature in Ringo is its auto-reloading module loader. It will pick up any changes as you code on a web applications without restarting. And while it is possible to disable reloading for deployment, it is so fast that you can usually leave it on if you want.

Another area we’ve put a lot of effort in is error reporting. In Ringo you will virtually always get file name and line number information as well as a full JavaScript stack trace with your errors. […] In addition, you’ll get detailed descriptions of syntax errors and warnings for missing var declarations, which are hard to debug and can alter the behaviour of JavaScript code in bad ways.

Another major productivity boost is Ringo’s Java interoperability. Using the LiveConnect feature of the Rhino JavaScript engine gives you instant access to the gazillion of Java libraries out there. Just put it on your classpath and start using it. [2]

Integrating with Java

  • java lib classes are are added to the ringojs configuraiton file:
importClass(java.io.File);

RingoJs and CommonJS

CommonJS modules are key enabling functionality in Ringojs.

The require function. Is like most languages import instruction.

How exactly a module identifier (or id) is mapped to a module is described below, but essentially the id is converted to a file name such as “ringo/args.js” which is then looked up in some directory.

The exports object. This is a plain JavaScript object used to export the module's API. The exports object is what the require function returns when the module is imported by other modules, so any property assigned to it is publicly available.

The module object. This is a JavaScript object that provides meta information to the module itself, such as the id and location of the module itself as well as the id of the main module.

 
ringojs_notes.txt · Last modified: 2010/11/18 09:16 by root
 
RSS - 200 © CrosswireDigitialMedia Ltd