As a relatively new software developer, and even newer web developer (my background is in Java programming), I was looking for something easy to use and with lots of documentation and support for my first web application. My first thought was Node.js. I’d heard so many good things about it – powerful, freedom in building apps, and easy to learn. But, I wasn’t sure where to start… I understood the concept of modules and installing them, but how do I use them and put it all together to create a complete web app?
Then I came across the Node.js module Express (https://expressjs.com/). It is a framework for Node.js for creating web servers and APIs. Essentially, it is a layer on top of Node.js and it differs from Node.js in that it is less complicated and faster. Express is not new – it was released in 2010 -- but it is still well supported and widely used. Express project set up is simple with the express-generator module. This module sets up the front-end with Jade files and a CSS file and the back-end with an app.js file with appropriate code and two routing files for the web app. It seemed perfect!
Now, where does Rational Application Developer come into play? Well for one, Rational Application Developer bundles the Node.js runtime, so there’s no need to install it! Secondly, and most importantly, Rational Application Developer can eliminate most command line work and have your Express JS project setup quickly in the workspace with the benefits of working with your project in an IDE.
Here are the steps to quickly get your Express JS project set up in Rational Application Developer
1. Before beginning, be sure that your Rational Application Developer installation contains the Cloud Tools feature
2. Create a new web project with Simple template, the programming model Java EE, and no target runtime set
3. Right click on the project and open Properties
4. Under Project Facets, select Node.js Application then click OK
5. Use the command line to convert the Node.js project to an Express project. Right click on the project > Cloud Foundry > Open in Terminal
6. Make sure that the node executable is in your PATH. To set this, run the following command:
SET PATH=%PATH%;”<RAD install dir>\runtimes\nodejs”
7. Install two node modules (this only needs to be done once per Node.js installation):
npm install -g express --prefix “<RAD install dir>\runtimes\nodejs”
npm install -g express-generator --prefix “<RAD install dir>\runtimes\nodejs”
8. Run this command to convert the Node.js project to Express framework:
9. Lastly, install the node modules:
10. Once this is complete, return to the Rational Application Developer workspace and refresh the project. Your project is set and ready to go!
An alternative option is to use an Eclipse Marketplace plugin:
1. Open Eclipse Marketplace and search for Node.js
2. Install IBM Node.js Tools for Eclipse
3. After the installation is complete, and Rational Application Developer is restarted, create a new Node.js project
4. Select Express as the template and click Finish
5. Your project is set and ready to go!
Nicole is a software developer for the Rational Application Developer product in HCL Technologies Products and Platforms division. She graduated from North Carolina State University with a B.S. degree in Computer Science in May 2013. She spent the next three years in quality assurance on an SVT team at IBM then at HCL Technologies. She joined the Rational Application Developer development team in January of 2017. Being a part of two different sides of the software lifecycle has greatly influenced her development process. She’s highly passionate about creating high quality software, web development, new technologies, and empowering women in computer science