Node.js

 
 
Node.js is a server-side software system designed for writing scalable Internet applications, notably web servers.
It is build on built on Chrome's JavaScript runtime. Programs are written on the server side in JavaScript, using event-driven, asynchronous I/O to minimize overhead and maximize scalability.

Node.js contains a built-in HTTP server library, making it possible to run a web server without the use of external software, such as Apache or Lighttpd, and allowing more control of how the web server works. Node.js enables web developers to create an entire web application in JavaScript, both server-side and client-side.

The latest Node.js version can be downloaded from: http://nodejs.org

Even numbered versions (0.4, 0.6, 0.8) are stable, and odd numbered versions (0.3, 0.5) are unstable. The stable releases are API-stable, which means that if you are using 0.8.1 and 0.8.2 comes out, you should be able to upgrade with no issues.







How to browserify bitcoinjs/bip44-constants



Information
Browserify will recursively analyze all the require() calls in your app in order to build a bundle you can serve up to the browser in a single <script> tag.

More information see:
http://browserify.org/
https://www.npmjs.com/package/bip39
https://github.com/bitcoinjs/bip44-constants

Operating system used
macOS 10.12 Sierra

Software prerequisites
node.js

Procedure
  1. Install browserify.
    Type: npm install -g browserify

  2. Show all installed node modules and their versions.
    Type: npm -g ls --depth=0

    You should see:
    [email protected]

  3. Show browserify help.
    Type: browserify --help

  4. In the following example "bitcoinjs/bip44-constants" will be browserified.
    Goto https://github.com/bitcoinjs/bip44-constants and download a release version, for example: v3.0.0.
    Unzip to folder ~/bip44-constants-3.0.0.

  5. Type: cd ~/bip44-constants-3.0.0

  6. I will demonstrate two ways to browserify the constants.json file.

    Method 1:
    • Type: browserify -r ./constants.json:bip44-constants | uglifyjs >
      bip44-constants.min.js

      This will create the bip44-constants.min.js file using the constants.json file as input.

      Note:
      The line "-r ./constants.json:MODULE_NAME" means in the test.html you need to add the line:
      var data = require("MODULE_NAME");

    • How this library is used in a test.html file:

      :
      <script type="text/javascript" src="../../scripts/bip44-constants/bip44-constants.min.js"> </script>
      :
      var data = require("bip44-constants");

      Object.keys(data).forEach(function (coin) {
         var constant = data[coin];
         var constantNum = parseInt(constant, 16);
         console.log(coin +" - "+constantNum);
      })


    Method 2:
    • Type: browserify -s data -r ./constants.json:bip44-constants | uglifyjs >
      bip44-constants.min.js

      This will create the bip44-constants.min.js file using the constants.json file as input.

      Note:
      The line "-s data" means in the test.html you DO NOT need to add the line:
      var data = require("MODULE_NAME");

    • How this library is used in a test.html file:

      :
      <script type="text/javascript" src="../../scripts/bip44-constants/bip44-constants.min.js"> </script>
      :

      Object.keys(data).forEach(function (coin) {
         var constant = data[coin];
         var constantNum = parseInt(constant, 16);
         console.log(coin +" - "+constantNum);
      })