Ringo in a Nutshell
- Stability
- Flexibility
- Security
- Open Source
- Ringo is powered by the Mozilla Rhino JavaScript engine, which is embedded in Java 6 as the default Java scripting engine and powers thousands of applications. Ringo itself enhances Rhino to run multi-threaded code. Ringo's core modules are well tested and documented.
- Applications can be deployed on nearly every JVM-based platform. Production-level Ringo applications run on large clustered servers, inside Linux containers, on cheap Raspberry Pi micro-computers, and on top of cloud platforms like Google App Engine.
- Ringo allows you to apply the Java security model on JavaScript applications. Developers can provide own security policies and control which resources can be accessed by untrusted code. JavaScript applications can be locked into a sandbox to isolate them from the OS.
- Ringo and all of its modules are released as open source software and the code is hosted on Github. It’s possible to fork, modify and distribute it in source or binary form. If you have a very specific question, you can look up the according code and see the detailed implementation.
Creating a simple web application
Our aim is to provide an off-browser JavaScript platform that has the right mix of features and simplicity to be pleasant to work with and easy to deploy. The primary goal is to build a stable, high-performance runtime for server-side use. The following code is all you need to create a simple web app:
exports.app = function(req) {
return {
status: 200,
headers: {"Content-Type": "text/plain"},
body: ["Hello World!"]
};
};
if (require.main == module) {
require("ringo/httpserver").main(module.id);
}
Simply save the code above as "server.js" and run it by executing ringo server.js
.
Like most Ringo apps, this app will automatically reload, picking up any changes you make
without requiring a restart.
Command-line Scripting
A very useful feature is the integrated REPL (Read-Eval-Print-Loop). You can enter it by starting
ringo
without any arguments from the command-line. This brings up a Ringo environment which can be
used for debugging, testing, or just playing around with the runtime. Since the deep Java integration,
it's possible to write CLI tools in JavaScript accessing arbitrary Java libraries.
Integrated into the Java Ecosystem
But Ringo lets you do more than write web applications. It allows you to seamlessly use any Java standard class or external library simply by dropping it into the classpath. This makes it easy to integrate Ringo into existing Java environments and reusing existing Java code works without lots of effort or porting issues.
Get Started or the documentation page to learn more about Ringo!