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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容