NodeRun Is Node.js For Everyone
May 13, 2019 Brian May
Working for a software development company like Profound Logic, I have the privilege of working on very interesting and exciting projects, both internally and with my customers. My days are filled with both the mundane and the exciting, but luckily, I have more of the latter than the former. I want to take a few minutes of your time to tell you about a project that has me as excited as I have been in quite a while.
Have you wanted to experiment with learning Node.js on IBM i, or any other platform? Have you considered using Node.js for a business application? Is your company slow to adopt or evaluate new technologies? Well, let me introduce you to NodeRun.
What Is NodeRun?
NodeRun is the free, easy, and social way to develop and deploy full-stack, enterprise-ready Node.js applications. We provide the cloud-based visual IDE, the database, and the server – you just need to bring your imagination.
We built NodeRun with business application development in mind. You can develop line-of-business applications faster than by traditional methods, making it an ideal solution for new and experienced Node.js developers alike. When you create an application in NodeRun, we provide you with a small instance of Ubuntu Linux, a MariaDB database, and a Node.js server running Express and our Profound.js framework. Everything you need to start developing your application and all running in the cloud.
Your Node.js business applications will be ready to run on databases and servers that include Oracle, SQL Server, MySQL, IBM Db2, and DB2 on IBM i – faster and easier than you believed possible. All in an environment built with features to make developers more productive.
- Cloud-based visual IDE with built-in database, server and runtime
- Ability to create, share, fork, and collaborate with the NodeRunonline community
- Unlimited public and private workspaces
- Built-In Callback Hell Prevention
- Layouts, Templates, Codeless Responsive Design, and 100+ Prebuilt UI Widgets
- Git and NPM Package integration
Creating A NodeRun Space
Getting started with NodeRun is simple. Just visit the noderun.com website and choose “Log In” at the top of the page. You can create an account manually, or sign in using Facebook, GitHub, or Google accounts.
Once logged in, you can create new spaces, browse your own spaces, and explore spaces other developers have published. If you find a space you would like to use, you can view the code for that space and even fork the space to have your own copy to modify.
I created a new space for this article to show how easy development in NodeRun can be. Below you will find a space I called Quiz App. You can view it in the embedded view below, search for it on noderun.com, or click the “Fork” button on the embedded view to make your own copy.
This space utilizes a service called jService.io. This service provides access to over 156,000 questions from the gameshow, Jeopardy! Using the built-in cloud-based IDE, I built a simple user interface by dragging and dropping elements on the screen and setting properties of those elements.
Then I utilized the integrated code editor to write my Node.js code to access the service and display the screens for my application. The editor in NodeRun is the same Monaco editor used in Microsoft’s Visual Studio Code IDE.
The Profound.js framework allowed me to consume the service with a single line of code. By using the pjs.sendRequest() API, I can call a web service and process the result without the need for callback functions or additional code. Even though much of the Node.js language uses asynchronous processing, in NodeRun, the Profound.js framework handles all the complexities and allows the developer to concentrate on the important parts of the logic.
I can also code my application in a stateful manner by using the .execute() API. This displays my screen and suspends my application until control is returned to the server. At that time, processing continues at the next line of code. This greatly simplifies building applications, especially business applications where process flow is paramount.
The application is not perfect, but I was able to build it out in less than an hour.
Integrating With IBM i
So, you have seen how to create a cloud-based application in NodeRun, and that is certainly exciting. But what if you would like to use that new cloud application within your IBM i application? You can do that too!
This takes a little bit more setup, but I will walk you through the basics.
- First, you need Profound UI and Profound.js installed on your IBM i. Once they are in place, you can call a NodeRun space directly from a Genie or Rich Display session.
- Next, there is a table named NODERUNACL in the Profound.js installation library on IBM i. This table consists of one column. You will need to add a row to the table with the name of each workspace owner account you wish to allow to be accessed from your system. In my case, my account name on NodeRun is “bmayprofound”, so I would add a row with that name.
- Now you have access to the NODERUN command on your IBM i.
When running a NodeRun space from your IBM i, the NodeRun application will access your IBM i tables for data instead of your space’s MariaDB instance. It can also call IBM i programs and procedures. This is all possible because of the Profound.js Connector. So now you can have a process running in the cloud that seamlessly integrates with your IBM i.
Let’s have a look at a small example. I have a space in my NodeRun account called to-do-list that is a simple app that allows the maintenance of a list held in a table.
I can run this space in NodeRun, and it will access the MariaDB instance in the space when running.
So, this is a functioning NodeRun space. Feel free to fork it if you would like to play with it. Now, I want to run this app from my IBM i using my Db2 database. First, I needed to recreate the table used by this space on IBM i. In the “Database” tab of the IDE, I can see the tables I have in this space and their definitions. In this case it is an extremely simple table.
Recreating this table on IBM i, was trivial. Now that it is in place, I have everything I need to call this application from IBM i.
I start by opening a session on IBM i. For simplicity, I am using our Genie on the fly UI modernization product.
I placed my new table in a library called DEMOLIB, so I need to make sure that the product libraries and DEMOLIB are in my library list. Then I can issue the NODERUN command.
The only parameters needed are the workspace owner and name. Issuing this command will create a connection to NodeRun using the Profound.js Connector running on IBM i. The app in the NodeRun space will run in the cloud, but communicate with IBM i, for external resources such as database tables. The interface, if the space has a UI, will display right within my Genie or Rich Display session in the browser.
While the technical aspects of NodeRun are great, it is important to note that NodeRun is designed to also be a community. You can explore projects posted by Profound Logic team members and other developers just like you. You can comment, ask questions, or just “like” any spaces. Maybe you have an idea for an enhancement to someone’s space. Leave them a comment. They can add your enhancement or even add you as a contributor to their space so you can make the changes yourself. You can share spaces you create for others to view and run. There is a discussion forum to socialize with other NodeRunners. You can also discuss ideas, report bugs, and ask questions of the community.
This Is Only The Beginning
Everyone on the Profound Logic team is excited about this new offering to the IBM i and Node.js community. It is important to note; this is only initial release. As the community grows and enhancements are added, NodeRun has unlimited potential. Best of all, NodeRun is free! Sign up for an account and join us as we reimagine application development.
This content is sponsored by Profound Logic.