node install

git clone https://github.com/wistingcn/wilearning

apt install nodejs
node -v
apt remove nodejs
apt install -f

#install node.js 12
apt update
apt -y upgrade
apt automove
apt -y install curl dirmngr apt-transport-https lsb-release ca-certificates
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
curl -sL https://deb.nodesource.com/setup_12.x | bash -
apt-get install -y nodejs

#install development tools used to build native addons
apt -y install gcc g++ make

node --version
npm --version

mkdir ~/projects
cd ~/projects

const http = require('http');

const hostname = '202.182.117.230';
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}/`);
});

node hello-world.js
npx pm2 start start.sh

ufw --help
ufw disable

posted @ 2022-05-24 17:06  mtgold  阅读(401)  评论(0编辑  收藏  举报