Nodyn is a node.js compatible framework, running on the JVM. It's powered by the DynJS Javascript runtime and Vert.x, the massively scalable, asynchronous, polyglot application platform.
"Why do that?", you may ask. Well, imagine running your node app on the JVM where you immediately have access to all that the Java world has to provide - directly from Javascript. You've got the entire Java ecosystem at your disposal. Since DynJS is cross-language compatible, why not throw in a little JRuby or Clojure with your app if you want. And with Vert.x built in, clustering your applications are a breeze.
There are two ways to run Nodyn: as a standalone REPL with vertx embedded, or as as a language module in Vert.x.
By default, Vert.x runs Javascript applications using the Rhino Javascript
runtime. But this is configurable in vert.x. You can configure your
application to use Nodyn by creating a langs.properties
file at the root of
your project that looks like this.
nodyn=org.projectodd~nodyn-verticle~0.1.1-SNAPSHOT:org.projectodd.nodyn.NodeJSVerticleFactory
.js=nodyn
Make sure that you have Vert.x 2.x or better installed, and start your application.
$ vertx run myApplication.js
Nodyn doesn't yet have an initial release. Until then, to use it, you will need
to build from source or download a CI SNAPSHOT from
Sontype.
Download the latest zip file from Sonatype. It will contain a ./bin/nodyn
binary.
You can use the binary to start an application from a Javascript file, or use the
REPL to experiment with small snippets of code on the command line.
$ ./bin/nodyn Usage: nodyn [--console |--debug | --help | --version |FILE] Starts the nodyn console or executes FILENAME depending the parameters
FILE : File to be executed by dynjs --clustered : Run a clustered instance on the localhost --console : Opens a REPL console to test small expressions. --debug : Run REPL in debug mode. --help : Shows current screen. Running without parameters also shows this. --version : Shows current dynjs version.
It is possible to start a small cluster on a single machine by using the
--clustered
option. For example this will start the REPL in clustered mode.
$./bin/nodyn --clustered --console
Execute this in multiple terminals to experiment with the clustered event bus provided by Vert.x
To build nodyn from source, check out the repo, and run mvn install
.
$ git clone https://github.com/projectodd/nodyn.git
$ cd nodyn
$ mvn install