Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

Node.js is getting a lot of attention from web developers and has had an amazing adoption among startups and tech companies.In my company bouvet , we haven't yet had much enquiries from customers on Node.js, but I am sure it is not far away.

"Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices."

10 years ago Server-side and JavaScript was an oxymoron, but now it is all the rage.

I was therefore not surprised when fellow sapmentor Dick Hirsch asked the all important question:

Even though SAP NetWeaver Cloud is extremely flexible, it requires that you are able to run the components on top of a Java Virtual Machine(JVM). Node.js runs on the Chrome JavaScript runtime V8 which is implemented in C++ and therefore you're unable to run it on top of the JVM

However, there exist other similar framework that run on other JavaScript runtimes which are implemented in Java. These are already running on the JVM, and can therefore easily be adapted to run on SAP NetWeaver Cloud.

Here are a few relevant frameworks:

  1. Ringojs
  2. Sprintstack
  3. Narwhal
  4. Helma

All of them use the Mozilla Rhino JavaScript engine, though some of them support other JavaScript engines as well.

The most active and mature of these, appear to be Ringojs (though I am no expert in this area at all).

Let's have a look at how we can run a Ringojs app with ServerSide JavaScript on SAP NetWeaver Cloud!

Update 22.10: The project is now shared in Github https://github.com/elsewhat/nwcloud-ringojs


How to

Deploying a Ringojs app to SAP NetWeaver Cloud is very simple. This because it has a project template for Java Web applications (tailored for Google App Engine). If you want to learn more about how ringo.js is integrated with the web container, see the JsgiServlet class.

Step 1

Download the ringo.js 0.8 binaries from http://ringojs.org/download and unzip to a local folder

Step 2

Open a command prompt and go to the bin subfolder of ringojs.

Run the command

ringo-admin create --google-appengine /path/to/appdir

where /path/to/appdir can for example be C:\DEV\temp\RingoJSNeo

Step 3

Start eclipse (with SAP NetWeaver Cloud SDK installed)

Step 4

Create new dynamic web project with name RingoJSNeo and use default settings.

For me the path of the project on the files system is C:\DEV\workspace_neo\RingoJSNeo\WebContent\WEB-INF

Step 5

Copy files from the ringojs-created project, to the web project in eclipse.

All files from C:\DEV\temp\RingoJSNeo\WEB-INF should be copied to C:\DEV\workspace_neo\RingoJSNeo\WebContent\WEB-INF

You can overwrite the web.xml without problems (although normally you would merge the files).

Eclipse will indicate a lot of errors in .js files, but you can safely ignore them.

This is how your project will look now:

(on the right you see the main.js that will be executed when an end-user access the web solution)

Step 7

Open http://localhost:8080/RingoJSNeo in your browser and you should see this screen

Summary

The Java Virtual Machine is a very flexible piece of software and with SAP NetWeaver Cloud you can fully utilize this.

So the next time @hipsterhacker disses enterprise software, tell him SAP runs server-side JavaScript.

3 Comments
Labels in this area