Venkatt Guhesan has been an Enterprise Java Architect with over 15 years of software development experience living and working in the Baltimore, Maryland area. Enjoys developing in Java, Scala, Groovy, Python, Ruby, Cold Fusion and Perl. Strong supporter of open source technologies including Linux and Apache Foundation. Venkatt is a DZone MVB and is not an employee of DZone and has posted 12 posts at DZone. View Full User Profile

Getting Started With vertx (vert.io) – an Alternative to node.js

11.21.2012
| 3835 views |
  • submit to reddit

 

Lately there has been a lot of synergy and publicity around node.js (especially if you want to utilize the robust features of a JavaScript language on the server-side). If you are not familiar with this, I would suggest you look at the following link:

Node.js – Event-driven I/O server-side JavaScript environment based on V8.

If you are a Java developer and as you try out the examples, you will notice how this will be a great addition into your infrastructure. But then as you delve deeper, you may notice some of the short comings such as having to support another full stack of package manager (Node uses NPM as it’s package manager) and it has it’s own deployment, unit testing, etc. to support. And then the thought might occur that – what-if I had the same infrastructure available natively in the Java stack??? Would that not solve a lot of the logistical challenges? If your answer is “yes”, then you should look at this library…

VertX from vert.io - Effortless asynchronous application development for the modern web and enterprise

The VertX solution is built upon (and requires) a JDK/JRE under the skin. But then because Java support other languages under it’s skin, you can leverage the benefits of languages such as - JavaScript, CoffeeScript, Ruby, Python, Groovy or Java.

According to the VertX website – it says and I quote “Write your application components in JavaScript, CoffeeScript, Ruby, Python, Groovy or Java. Or mix and match several programming languages in a single app.”

Here’s their “Hello-World”:

load('vertx.js')
 
vertx.createHttpServer().requestHandler(function(req) {
    var file = req.path === '/' ? 'index.html' : req.path;
    req.response.sendFile('webroot/' + file);
}).listen(8080)

As always, you need to evaluate this option to see if this solution fits in your infrastructure and it’s pros and cons.

If you find this article useful, share this with others and/or subscribe to this blog.


Published at DZone with permission of Venkatt Guhesan, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)