The following steps take you through creating a Node.js application using the Express Application Generator then deploying it to CICS®.

Before you begin

CICS TS V5.5 introduced support to run Node.js applications and is required by this tutorial. If you do not have a CICS TS V5.5 (or higher) region, use the steps in Provisioning a CICS region using z/OS® PT to provision one, or speak to your CICS system administrator.

Procedure

  1. Install the Zowe CLI and plug-ins by following the steps in Installing.

  2. Create Zowe CLI profiles by following the steps in Creating Zowe CLI profiles.

  3. Create a Node.js application using the Express Application Generator:

     npm install -g express-generator
     express myExpressApp
     cd myExpressApp
     npm install
     npm start
    

    The Node.js application will start. You can call the application from a browser by using URL http://localhost:3000/. To stop the application in the console press CTRL+C.

  4. Package the Node.js application into a CICS bundle.

    Make sure that you are in the root directory of the application.

    Replace the value for --port with one that is available for use by the CICS region on z/OS. This sets the PORT environment variable in the generated .profile file. Additional variables can be set by editing this file.

      zowe cics-deploy generate bundle --port 3000 --overwrite
    

    The output indicates the directories and files that are created to form a CICS bundle. For example:

     define : NODEJSAPP "myexpressapp" with startscript "./bin/www"
     create : nodejsapps
     create : nodejsapps/myexpressapp.nodejsapp
     create : nodejsapps/myexpressapp.profile
     create : .zosattributes
     create : META-INF
     create : META-INF/cics.xml
     CICS Bundle generated with bundleid "myexpressapp"
  5. Confirm that the Node.js version installed on z/OS is suitable for your application.

     zowe zos-uss issue ssh "node --version"
    

    The output should indicate the installed version of Node.js.

  6. Deploy the CICS bundle into CICS.

     zowe cics-deploy push bundle --name Express --overwrite
    

    A progress bar is shown with status messages as the CICS bundle is deployed and the application is started. This can take a few minutes. The command will summarize the deployment, including the Node.js runtime .stdout and .stderr file names that the application will write output to:

     Regions in scope 'CICPY000' of CICSplex 'ZOSPTINT':
     Applid: CICPY000   jobname: CICPY000   jobid: STC35860   sysname: MV2C
        
     NODEJSAPP resources for bundle 'Express' in scope 'CICPY000':
     NODEJSAPP resource 'Express' is in 'ENABLED' state in region 'CICPY000' with process id '16844444'.
     stdout: /u/cicprov/mnt/CICPY000/workdir/CICPY000/myexpressapp/Express/D20190612.T144609.stdout
     stderr: /u/cicprov/mnt/CICPY000/workdir/CICPY000/myexpressapp/Express/D20190612.T144609.stderr
     PUSH operation completed

    This results in a CICS BUNDLE resource named Express being defined, installed, and enabled in CICS. If the BUNDLE Express was already defined or installed in CICS, it is undeployed first. As the BUNDLE is enabled, the application is started. If there are errors, retry with the --verbose option for more detailed output, or refer to Troubleshooting.

  7. Test the application.

    You can call the application from a browser by using URL http://myzos:3000/, replacing myzos with the host name of the z/OS system, and 3000 with the port specified in step 4.

    If you make changes to the application, you can redeploy it by repeating step 5.

  8. View the application output files.

    Use the Zowe extension for Visual Studio Code or Zowe CLI commands to view the application output files. For example:

     zowe zos-uss issue ssh "tail -f /u/cicprov/mnt/CICPY000/workdir/CICPY000/myexpressapp/Express/D20190612.T144609.stdout"
    

Results

The Node.js application is packaged into a CICS bundle on the workstation, uploaded to a directory on z/OS, and is running in CICS.

Tags: tutorial