Recently wanted to try to create a Web application using node. js on IBM Bluemix, so you need to build a dev test environment for node. JS Web locally.
What is node. js? let's see what the encyclopedia says.
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.
Do you understand me?
Seriously, I didn't read it!
So what exactly is node. js?
Web back-end development language, do you understand this?
ASP, JSP, PHP is what you do not understand?
Well, do you want to use JS to access the database to process user requests?
Download node. JS Website Address: https://nodejs.org/en/
You can directly click on the link to enter:
My is the Windows 7 x64 system, the selected version is: v4.2.4 LTS, relatively more mature and reliable version;
Install node. js
Follow the steps to install the line, there is nothing to say, stickers just give no contact with an intuitive impression!
When the installation is complete, a node. js directory is added to the Start menu as shown in:
Click node. js to open a command-line window and enter "OS" to try it out
First Web server
Contact more, found a lot of language in the Web development time can be based on the language itself to write Web server!
The go language is so, and so is the Python language, so is node. js;
But usually we may not do this when the project is developed because there is usually a more complete server framework available.
Save the following code as a "helloworld.js" file:
var http = require (' http '); var server = Http.createserver (function (request, response) { response.end ("Hello world!"); }); Server.listen (8080);
How many lines of code does a Web server have?
Yes, that's right!! However, this is a relatively retarded Web server, it will only return "Hello world!".
Require for a lot of front-end small partners should be more familiar with it?
as long as the JS on the line, you can become a web development front-end + back-end of the master !
Open the command line and switch to the Save directory of "Helloworld.js" file, execute: node helloworld.js
If you turn on the firewall, you should see:
Click Allow access, open the browser, enter "http://localhost:8080/" visit to see it!
Summary
Here node. JS Web Development environment is set up, it is so simple, you also try it!
The node. JS Web Development Environment Build note under Windows 7