ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
RingoJS
FinJUG talk by
Oleg Podsechin
15.01.2013
RingoJS
Overview
? started by Hannes Walln?fer
? successor to Helma, HelmaNG
  o been in development for 13+ years
? runs on the JVM
? uses Mozilla Rhino
? conforms to CommonJS
CommonJS
? Modules/1.0, Modules/1.1
? JSGI
? Binary
? Filesystem
? System
? Unit Testing
Features

 ?   hot reloading of modules
 ?   profiler
 ?   debugger
 ?   sandboxing
 ?   runs anywhere Java runs
     ?   within a webapp container
     ?   standalone process
Install & Run
git clone git://github.com/ringo/ringojs.git
ant update jar
bin/ringo
Hello World
>> 'Hello World'
Hello World
Hello World, Take Two
new require('ringo/httpserver').Server({
    app: function() {
    return {status: 200,
              headers: {},
              body: ['Hello World']}; }
  }).start();
Multithreaded JS
// run "test" in "threads" parallel threads a total of "count" times
function?parallel(test,?count,?threads)?{??var?pool?=?new?
????
   java.util.concurrent.Executors.newFixedThreadPool(threads);??functio
   n?runnable(f)?{??
   ??return?new?java.lang.Runnable({?run:?function()?{????
   ??try?{?f();?}?catch(e)?{?}??
   ??}});??}??for(var?i?=?0;?i?<?count;?i?++)????
   pool.execute(runnable(test));}
RingoJS libraries
? search GitHub for ringo-

ringo-admin?install?
  user/repo

? use rp and packages.ringojs.org
rp?install?name
Examples of RingoJS libraries

? stick
? ringo-modulr
? ringo-storable
  ? ringo-filestore, ringo-hibernate
? ringo-mongodb
? ringo-mail
Stick Example
var?{Application}?=?require("stick");????

 var?app?=?Application();????

 app.configure("error",?"notfound",?
 "route");
 var?response?=?
 require('ringo/jsgi/response');????

 app.get("/",?function(req)?{
 ???return?response.html("Hello");
 });???
Community
? #ringojs on Freenode IRC
? #ringojs & @ringojs on Twitter
? http://github.com/ringo
Use Cases & Benefits
? standalone
? to extend an existing Java webapp
? plugin architecture for existing application
? code reuse between server and browser

? less context switching
? more compact code, faster prototyping
Extras
? Common Node
? Nashorn
? Node.jar
? Vert.x
@olegpodsechin
github.com/olegp

More Related Content

RingoJS

  • 1. RingoJS FinJUG talk by Oleg Podsechin 15.01.2013
  • 3. Overview ? started by Hannes Walln?fer ? successor to Helma, HelmaNG o been in development for 13+ years ? runs on the JVM ? uses Mozilla Rhino ? conforms to CommonJS
  • 4. CommonJS ? Modules/1.0, Modules/1.1 ? JSGI ? Binary ? Filesystem ? System ? Unit Testing
  • 5. Features ? hot reloading of modules ? profiler ? debugger ? sandboxing ? runs anywhere Java runs ? within a webapp container ? standalone process
  • 6. Install & Run git clone git://github.com/ringo/ringojs.git ant update jar bin/ringo
  • 7. Hello World >> 'Hello World' Hello World
  • 8. Hello World, Take Two new require('ringo/httpserver').Server({ app: function() { return {status: 200, headers: {}, body: ['Hello World']}; } }).start();
  • 9. Multithreaded JS // run "test" in "threads" parallel threads a total of "count" times function?parallel(test,?count,?threads)?{??var?pool?=?new? ???? java.util.concurrent.Executors.newFixedThreadPool(threads);??functio n?runnable(f)?{?? ??return?new?java.lang.Runnable({?run:?function()?{???? ??try?{?f();?}?catch(e)?{?}?? ??}});??}??for(var?i?=?0;?i?<?count;?i?++)???? pool.execute(runnable(test));}
  • 10. RingoJS libraries ? search GitHub for ringo- ringo-admin?install? user/repo ? use rp and packages.ringojs.org rp?install?name
  • 11. Examples of RingoJS libraries ? stick ? ringo-modulr ? ringo-storable ? ringo-filestore, ringo-hibernate ? ringo-mongodb ? ringo-mail
  • 12. Stick Example var?{Application}?=?require("stick");???? var?app?=?Application();???? app.configure("error",?"notfound",? "route"); var?response?=? require('ringo/jsgi/response');???? app.get("/",?function(req)?{ ???return?response.html("Hello"); });???
  • 13. Community ? #ringojs on Freenode IRC ? #ringojs & @ringojs on Twitter ? http://github.com/ringo
  • 14. Use Cases & Benefits ? standalone ? to extend an existing Java webapp ? plugin architecture for existing application ? code reuse between server and browser ? less context switching ? more compact code, faster prototyping
  • 15. Extras ? Common Node ? Nashorn ? Node.jar ? Vert.x