Node.JS Packaging

Once you have completed your application, you need to package it to send to different machines. Node.js has JX core project which helps packaging of the application. Consider a scenario where you have node.js application written on multiple pages the JXCore project help you bundle all the modules in one. In this article we shall explain node.js packaging.

JXCore installation

Perform the following steps in order to download and install JXCode.

Step1

Download JXCore from this https://github.com/jxcore/jxcore-release. The version you installed depends upon your machine requirements. We shall explain installing JXCore for windows.

Step2

Open the rar file that you downloaded and copy and past “jx” application file to any folder. Set the path of that folder in your environment variable

Step3

Finally, to verify if JXCore has successfully been installed type “jx –version” on command prompt. It should display the version number.

Node.js Packaging Code

Now once you have successfully installed the JXCore module, you can package any code. Suppose you have fork.js and child.js files that you created in the node.js child process creation article. You want to package these two files.

To do so, simply go inside the directory that contains these two files and open command window here. We know the entry point of our code is “fork.js” because this is the parent process that calls the child process. Therefore, the command that you will use to package all the files in this directory will be “$ jx package fork.js fork”. We named “fork” at the end because this is the name with which the package file will be generated

If you run the above command, you will see two files generated in the directory: fork.jx and fork.jxp. Here the first file is what you need to ship to the client. It is the file package. The second file.jxp file is the file that contains meta data info.

Running JX File

Running JX file is very simple. Type the command “jx fork.jx”. This will execute the fork.jx file that contains your application.

Copyright 2005-2016 KnowledgeHills. Privacy Policy. Contact .