(877) 224-7768 <>
sales@profoundlogic.com <mailto:sales@profoundlogic.com>

iModernize - The Profound Logic Software Blog

NodeRun Guided Lab: Employee Data Application - Part 6

Posted by Profound Logic on May 7, 2019 12:26:46 PM


NodeRun trans

NodeRun
is the newest Profound Logic product dedicated to making it easier for Node.js developers to create applications by moving development to a cloud-based environment. NodeRun comes with a full IDE with Visual Designer, editor, debugger, and Node.js already pre-installed. Some of NodeRun's most notable capabilities include design screens, the ability to develop and run application within the program, full debugging capabilities, the ability to install NPM packages, manage your own Node.js server, work with active sessions to see end-user activity, host database and built-in Database Explorer, a command-line terminal for full control of your space, as well as the ability to share and collaborate with other developers.

Getting started with NodeRun is quick and easy. All you need is a modern internet browser (Google Chrome, Mozilla Firefox, etc.) and that's it. Every NodeRun Space is free to build and comes with its own files, database, and server. To get started visit NodeRun.com create an account and begin developing, it's that easy!

This 8 part blog series will give you a set of exercises to help you build a Node.js applications that work with employee data. Last week we looked at how to list a web service within NodeRun, this week we are going to learn how to create a details web service.

Exercise 8 - Details Web Service

Within the IDE Visual Designer, select the New tab and select JavaScript File. 

new javascript-1

After starting a new JavaScript file enter the code below and save as get_employees.js.

details web service code

Code Explained

code explaine

  • request.params allows you to access parameters passed as part of the URL
  • Other types of request parameters can be accessed as well
    • request.query gives you query string parameters
    • request.body gives you POST data parameters
  • records.length specifies how many record were retrieved; if 0, we send a { success: false } response

Create Web Service Out of get_employee.js

On the right hand menu right click the saved file under Files and select Properties:

properties file-1

Then select the following:

  • Web Service
  • HTTP Method: get
  • Route Path: employee/:empNum

properties-1

Test Details Web Service

Select the Launch button and select Launch App in Browser Tab. In the new tab, select the Test Details Web Service button. 

Test details web service

You can also try modifying the employee number within the URL ( as seen in the image above).


In our next post, we will get discuss Consuming a Listing Web Service using NodeRun.

If you missed out on any of our previous Guided Labs here is a recap of those exercises:

Topics: RPG Development, Application modernization, IBM i applications, Node.js, Profound.js, IBM i, RPG, AS400 modernization, IBM i Modernization, Agile modernization, iSeries, Legacy Modernization, Profound UI, AS 400, AS_400, Profound Logic

Subscribe to Blog Updates

...and get The 2019 State of IBM i Modernization White Paper FREE!

cover page 2019-1

Recent Posts