I'm using the window system, and the rest of the system should be similar.
1. Download
https://nodejs.org/en/
Just click on the latest version to download.
2. Installation
3. Testing
Open cmd command line, input node directly and enter
Type Console.log ("hello,world!");
View Output Results
hello,world! undefined
4. Create a working directory
Find a system disk, create a workspace\nodejs\
5. Create a simple Web project
Create Httpdemo/test.js
Write the following code:
var http = require ("http"); http.createserver(function(req, res) { Res.writehead ( {"Content-type": "Text/html"}); Res.write ("); Res.end ("<p>game over Hhhhh</p>");}). Listen (8089); Console.log ("HTTP server is listening at Port 8089.");
Then start:
CMD go to file directory input: node test.js
Enter
Then enter it in the browser: http://localhost:8089/
If you can see the output, it indicates success.
Nodejs beginners and simple web cases