Introduction:JavaScript is a script run in the browser, it is simple, lightweight, easy to edit, this script is usually used for front-end programming of the browser, but a developer Ryan discovered that the front-end scripting language can run on the server, a storm sweeping the world began. node. JS is a platform built on the chrome JavaScript runtime to easily build responsive, easy-to-scale Web applications. node. js is lightweight and efficient with event-driven, non-blocking I/O models and is ideal for data-intensive, real-time applications running on distributed devices. Node is a JavaScript run environment (runtime). It actually encapsulates the Google V8 engine. The V8 engine executes JavaScript very fast and performs very well. Node optimizes some of the special use cases, providing an alternative API that allows V8 to run better in a non-browser environment.
installation and configuration of Nodejs under Windows
The first step is to download the installation files from the official website https://nodejs.org/en/Here we download the MSI installer.
Step Two: Install the download file MSILocate the file that you just downloaded Node-v4.2.1-x64.msi, dual plus installation, installed by default in the C:\Program Files\nodejs directory, can be customized when installing the directory this assumes the installation to D:\Program Files\nodejs, After installation prompts for successful installation win+r open the Command Window CD d:\Program Files\nodejs switch to the root directory, enter node-v to display the version number of node: the minor version number indicates that the installation was successful. and write the directory into the environment variable:
Step three: NPM installation
Since NPM has been integrated with the new version of Nodejs, NPM has been installed as well. You can also use the cmd command line to enter "Npm-v" to test for successful installation. For example, a version prompt indicates that the installation was successful.
Fourth Step: Install the relevant environmentInstall Express Development Framework input: NPM install-g Express-generator later prompts for installation success, enter the command express-v will show the version number of Express to this NODEJS development environment Basic installation is complete. Below we simply test under Nodejs, new test.js, Path D:\sunyj\test.js, test.js content as follows:
var http = require ("http"); Http.createserver (function (request, response) {Response.writehead ($, {"Content-type": "Text/plain"}); Response.Write ("Test Nodjs"); Response.End (); }). Listen (8899); Console.log ("Nodejs Start listen 8899 port!");
Open a Command window and enter node D:\sunyj\test.js to see the following window:
Enter in the browser: http://localhost:8899 will see: Good text to the top attention to my collection of this article
node. JS installation Configuration and Testing