How to launch a nodejs development enviroment in Windows?

How to launch a nodejs development enviroment in Windows?

Step #1: Download the installer package msi, Download Link;

Step #2: Normally, the nodejs will default to be installed in the path "C:\Program Files\nodejs";

Step #3: Open the Windows command terminal, change the current directory to nodejs's directory, such as Step #2;

Step #4: Execute node -v to check if nodejs is correctly installed. If okay, you can get the output, such as my output is v6.10.0 .

Step #5: Create a file named 'hello.js' in the current directory, here is the code of hello.js.

 var http = require('http');
 
 http.createServer(function(req, res) {
    res.writeHead(200, {
        'Content-Type': 'text/plain'
    });
    res.end('Hello jmaea\'s JavaScript world.\n');
 }).listen(1338, "127.0.0.1");

 console.log('Server running at http://127.0.0.1:1338');

Step #6: Execute the command "node hello.js" in the Window's command terminal;

Step #7: Open the browser and browse the url - http://127.0.0.1:1338

你可能感兴趣的:(How to launch a nodejs development enviroment in Windows?)