How to install nodejs on Xampp localhost

前端 未结 7 2041
醉话见心
醉话见心 2020-12-23 16:23

Been seeing a lot of how to\'s on how to install nodejs but nothing is at all clear.

So I ask...

Can someone provide a step by step installat

7条回答
  •  长情又很酷
    2020-12-23 17:09

    After searching (source), I have found, that it's easier to install Node.js directly (so, no need of XAMP/WAMP):

    1. Install http://nodejs.org/download/

    2. Create a test file (example) C:\myFolder\test.js and put this code in that file:

      var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\n'); }).listen(1337, "127.0.0.1"); console.log('Server running at http://127.0.0.1:1337/');


    3) Open CMD (COMMAND PROMPT) and execute:
    node C:\myFolder\test.js
    

    4) Open this address in your browser: **`http://127.0.0.1:1337/`**

提交回复
热议问题