Nothing to do, study a node. js, although there are a lot of resources on the Internet tutorial, but it is not as good as the memory of their own handwriting to the deep.
Create a node server The first step: Download the node. JS installation and configure environment variables.
Create node Server second step: Find the root directory of node. js, drive letter: \nodejs\node_modules This is the root directory of node. js.
Create a node server step three: Create a new JS file, such as Server.js, placed under the Node_modules directory.
Create a node server fourth step: Edit the Server.js file, the code is as follows
//introducing the Require modulevarHTTP = require (' http ');//setting up HTTP requestsHttp.createserver (function(Request, response) {//Send HTTP Header //HTTP Status value: 200:ok //content Type: Text/plainResponse.writehead (200,{' content-type ': ' Text/plain '}); //Send response data: "Hello World"Response.End ("Hello world\n");}). Listen (8888);//The terminal printing information is as follows:Console.log (' Server running at http://127.0.0.1:8888/');
This creates a node server, which is now ready to be tested.
Test phase:
1. Open the cmd command line, enter the drive letter: \nodejs\node_modules, run the command: node server.js, do this step to see the effect of
, you can see the effect by copying the http://127.0.0.1:8888/into the browser.
After the next node implementation for the last couple of years and then pasted up ...
Beginner Node,js Primer (1) ======== Build the first node server