+ All Categories

RingoJS

Date post: 13-Jan-2015
Category:
Upload: oleg-podsechin
View: 1,088 times
Download: 1 times
Share this document with a friend
Description:
 
16
RingoJS FinJUG talk by Oleg Podsechin 15.01.2013
Transcript
Page 1: RingoJS

RingoJSFinJUG talk byOleg Podsechin15.01.2013

Page 2: RingoJS
Page 3: 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

Page 4: RingoJS

CommonJS

Modules/1.0, Modules/1.1

JSGI

Binary

Filesystem

System

Unit Testing

Page 5: RingoJS

Features

hot reloading of modules

profiler

debugger

sandboxing

runs anywhere Java runs

within a webapp container

standalone process

Page 6: RingoJS

Install & Run

git clone git://github.com/ringo/ringojs.gitant update jarbin/ringo

Page 7: RingoJS

Hello World

>> 'Hello World'Hello World

Page 8: RingoJS

Hello World, Take Two

new require('ringo/httpserver').Server({  app: function() {    return {status: 200,             headers: {},             body: ['Hello World']};  }}).start();

Page 9: RingoJS

Multithreaded JS// run "test" in "threads" parallel threads a total of "count" timesfunction parallel(test, count, threads) {  var pool = new 

java.util.concurrent.Executors.newFixedThreadPool(threads);  function runnable(f) {    return new java.lang.Runnable({ run: function() {      try { f(); } catch(e) { }    }});  }  for(var i = 0; i < count; i ++)    pool.execute(runnable(test));}

Page 10: RingoJS

RingoJS libraries search GitHub for ringo-

ringo-admin install user/repo

use rp and packages.ringojs.orgrp install name

Page 11: RingoJS

Examples of RingoJS libraries

stick

ringo-modulr

ringo-storable

ringo-filestore, ringo-hibernate

ringo-mongodb

ringo-mail

Page 12: RingoJS

Stick Examplevar {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");});

Page 13: RingoJS

Community

#ringojs on Freenode IRC

#ringojs & @ringojs on Twitter

http://github.com/ringo

Page 14: RingoJS

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

Page 15: RingoJS

Extras

Common Node

Nashorn

Node.jar

Vert.x

Page 16: RingoJS

@olegpodsechingithub.com/olegp


Recommended