Setting Up Node.js

Node.js is a JavaScript platform based on Google Chrome’s V8 engine that enables you to run JavaScript applications outside of a web browser. It is an extremely powerful tool, but in this book I’m going to cover only the basics of using it as the web server to support the AngularJS application examples.

To install and use Node.js you will need to perform the following steps:

1. Go out to the following URL and click on “INSTALL.” This will download an installable package to your system. For Windows boxes you will get a .MSI file, for Macs you will get a .PKG file, and for Linux boxes you can get a .tar.gz file.

http://nodejs.org

2. Install the package. For Windows and Macs simply install the package file. For Linux go out to the following location for instructions on installing using a package manager.

https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager

3. Open a terminal or console window.

4. Type node to launch the Node.js JavaScript shell and you should see a > prompt. The Node.js shell provides the capability to execute JavaScript commands directly on the underlying JavaScript engine.

5. If the node application is not found, you need to add the path to the node binary directory to the PATH for your development system (this process is different for each different platform). The binary directory is typically /usr/local/bin/ on Macs and Linux boxes. On Windows the binary directory will be in the <install>/bin folder where <install> is the location you specified during the install process.

6. Then you get to the > prompt. Type the following command and verify that Hello is printed on the screen:

console.log("Hello");

7. Use the following command to exit the Node.js prompt:

process.exit();

You have now successfully installed and configured Node.js.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset