1. For node. JS installation Here is not too much to introduce, after the successful installation, you can use the CMD input node-v to view the version number of node,
2. Start our Hello world, enter the owning folder via CMD, input node 01.js
// require means introduction package var http = require ("http" // Create service var server = http.createserver (function (req,res) { // req represents the request, and RES represents the response // res.writehead (200,{" Content-type ":" Text/html;charset=utf-8 "}); Res.end ( "Haha, this is my first page" + (1+2+3) + "s" // running server, listening port number 3000, port number can be changed to Server.listen ("127.0.0.1");
3. Then enter 127.0.0.1:3000 in the browser window and you will see the following screen
Attached to Node's official website, you can see all the methods and properties Https://nodejs.org/docs/latest-v7.x/api/http.html#http_response_write_chunk_encoding_callback
node. js First Knowledge 01