I was curious if I install node.js on my machine. My concern was what if that makes slower performance or any unexpected side effects. As a result, it seems not making any problem as long as you just installed it on your machine.
You can download the installer at http://nodejs.com
It seems like the website automatically recommend the most appropriate one by the operating system. Because my machine is windows, it recommends me to install x86 version of node.js.
If you installation is perfect, let us run below simple node.js code which can make your pc into simple web server.
const http = require('http'); const hostname = '127.0.0.1'; const port = 3000; const server = http.createServer((req, res) => { res.statusCode = 200; res.setHeader('Content-Type', 'text/plain'); res.end('Hello World\n'); }); server.listen(port, hostname, () => { console.log(`Server running at http://${hostname}:${port}/`); });
Once you created above js code as "sample.js", you can simply run "node sample.js"
x:\prj\js>node main.js Server running at http://127.0.0.1:3000/
You can check it on your browser at http://127.0.0.1:3000 and its result will be like below: