Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

« Previous Version 9 Next »

It is possible to debug existing or newly creating Profound.js modules on your local machine.

The first step is to install Profound.js onto your local machine by using 'npm install profoundjs'

This guide will show you how to debug an existing application - the same application generated in the Generating Profound.js Modules with JumpStart guide.

 

Step 1 - Setup

Firstly, you have to copy all the source (and dependencies for that source) onto your local machine.

For example, if your Profound.js module was stored in /profoundjs/modules/demolib/prodapp.js on your IBM i, then you would copy it to /profoundjs/modules/demolib/prodapp.js on your local machine.

If you have to copy a Profound.js module into a directory that does not exist on your local machine yet, do not forget to add it to your pathlist on your Profound.js server settings.

 

Step 2 - Test

Once you have mapped the files to your local machine, you should test that your IBM i can reach your local machine.

  1. In your genie session, use command PJSMYIP. This changes your session to point to your local Profound.js server.
  2. Start your local Profound.js server. Change your current directory to your Profound.js and use 'node start' to start the Profound.js server.
  3. Lastly, call your program: CALL PRODAPP. This will redirect the call to your local Profound.js server, where the JavaScript is run.

 

Step 3 - VSCode Debug Setup

For VSCode, you will want to open your Profound.js directory as your workspace. This is so it's easy to navigate and debug through existing source.

You will also want to create a new debug configuration, which looks like this:

        {
            "name": "Launch",
            "type": "node",
            "request": "launch",
            "program": "${workspaceRoot}/start.js",
            "stopOnEntry": false,
            "args": [],
            "cwd": "${workspaceRoot}",
            "runtimeArgs": [
                "--nolazy"
            ],
            "env": {
                "NODE_ENV": "development"
            },
            "console": "internalConsole",
            "sourceMaps": false
        }

This mean. that when you start debugging it will launch the Profound.js inside of your VSCode instance. This allows you to put breakpoints into Profound.js modules.

To test this debug configuration is working, when you start debugging you should see the following in your 'DEBUG CONSOLE':

To debug our application, open the file in VSCode and set a break point. To test, we will set one at the Profound.js module entry point.

  • No labels