After you install node. js, choose a beneficial IDE for your development.
After comparing multiple Ides, it is positioned on webstrom and sublime.
There is a simple comparison:
Webstorm feature is very rich, the front-end development tool of the synthesizer, compared to sublime slightly heavier
Sublime plug-in is also very rich, the interface is more beautiful, very light, also has a simple project management function
Here you choose to use sublime as the development tool for node. js.
Fool installation, installation complete start.
The use of sublime, there are a lot of small tricks.
Please check the relevant documents on the website for further use.
Then go to node. JS's official website and find an example in the documentation using a Web server written by node. js.
1. First use sublime to open a folder, and then you can create a new file under this folder
2. Next, you directly on this file page, write on Start.js,
On the amount can be completed saving this JS file.
3.start.js file after saving, delete the text of the file name + suffix, the Generals online This section JS Small example affixed to this JS file
For the difference between Const and VAR, see
1Const HTTP = require (' http ');2 3const hostname = ' 127.0.0.1 ';4Const PORT = 3000;5 6Const SERVER = Http.createserver ((req, res) = = {7Res.statuscode = 200;8Res.setheader (' Content-type ', ' Text/plain ');9Res.end (' Hello world\n ');Ten }); One AServer.listen (port, hostname, () = { -Console.log (' server running on http://${hostname}:${port}/'); -});
View Code
"Tip 1": If you want to modify the same variable above JS, for example: above the const, you can put the cursor on any const, and then ctrl+d, click multiple times to select more than one const.
4. After saving JS file, go to DOS window
5. Now you see that you have printed out the http://127.0.0.1:3000/, a server running on this machine with Port 3000 running up
Then access this address on the browser
6. Modify Start.js, front desk refresh
After modifying the start.js, the Refresh browser did not change because the server did not restart
In the DOS window CTRL + C, you can stop the startup service, and then restart the service
7. The above can be used sublime to write JS files, using the node. JS engine to run the JS file JS code, you can run up a pure JS write server.
"Node. js" 2. Developing node. js to choose which IDE development tool?