Jak zainstalować węzeł na Androida za pomocą termux
//launch termux and run the fellowing commands
apt update
apt upgrade
apt install nodejs
apt install vim (optional- vim is a text editor)
apt install wget (optional - enables you to browse from the terminal)
apt list --installed (to see all the installed pkgs)
//Done you just installed nodejs and ready to build your app.
//now node is installed let create a simple node project
//code continues...
mkdir app
cd app
npm init
//click the enter to go through the prompts to create a package.json file
//installing express module - to create simple web sever
npm install express -only=prod -save
npm list -depth=0 (to view the version of express installed)
vim index.js (lauch the index.js in the termianl)
i (click "i" to enable you write to the index.js file)
//now write the fellowing code to your index.js file to test our created nodejs app
const app = require('express')();
app.get('/home',(req,res)=>{
res.send('awsome!. You just launched your first nodejs app');
});
app.listen(3000);
//type the fellowing codes after writing
ctrl+c (to switch to vim command input)
:x (to save your modified index.js file and take you back to the bash terminal
//lauching our simple nodejs app
node index.js
//now launch your browser and visit the bellow url to see our app running
http:localhost:3000/home
//if the above is not working try this
http:127.0.0.1:3000/home
//and you should see your app runing done
Busy Butterfly