setup nodejs code example
Example 1: nodejs install
curl -O https://nodejs.org/dist/v14.16.1/node-v14.16.1-linux-x64.tar.gz
tar -xvzf node-v14.16.1-linux-x64.tar.gz --strip-components=1
# Add node and npm it to PATH (and do so for future sessions too)
export PATH=$HOME/node/bin:$PATH
echo 'export PATH=$HOME/node/bin:$PATH' >> ~/.bashrc
Example 2: nodejs install
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.end('Hello World!');
}).listen(8080);