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. 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 series of exercises to help you build a Node.js applications that work with employee data. This first exercise will show you how to create an Employee Lookup Module.
To begin, visit https://noderun.com/ide/profound-logic/guided-lab/ and press the Fork button on the home page (if you are not signed in, create an account or sign in). Give your space a name... for this example we will name it My Lab. After naming your space, click Fork and click Close on the next prompted screen. This will change the URL in your browser to show your profile name and your new workspace name.
Next, drag-and-drop the Label widget onto the panel for each label that you want to add. After that you will want to add a Primary Button widget and a Cancel Button widget for an "Ok" button and a "Cancel" button.
Under the Database tab find employees and right click. Then press the Query option to find and review your employee data.
Make sure you have the Input mode selected and drag the employeeNumber to your display screen.
Next, switch to Output mode and drag the lastName, firstName, email, and jobTitle to your display screen.
Select the Ok button and use the Graphic Button Properties on the right hand side to bind response of Ok button to ok and bind response of Cancel button to cancel. Please keep in mind that the case of the field names do matter. "ok" is not the same as "Ok."
Above the Screen Properties box you will see a Screens tab. Press the pencil/edit icon and name your screen lookup.
Next click the Save button and name your file lookup.json.
Select the New button and scroll down to JavaScript File and enter the code as it is shown below and save it.
Code Explanation:
exports.run = lookup
pjs.defineDisplay ("display", "lookup.json");
display.lookup.execute( );
while (!cancel) }
// ...
}
pjs.query("SELECT * FROM employees WHERE emplyeeNumber = ?" , [employeeNumber]);
var record = results [0];
pjs.setFields (record) ;
Select the Launch button and select the Launch App in Browser Tap option. The running application will look like this:
In our next post we will learn how to use the database-driven auto-complete option as well as how to add a dynamic image to your display.