Skip to main content

Posts

Showing posts with the label node

Install node.js in ubuntu

ပ ထမဆံုး http://nodejs.org/ မွာ သြင္းမယ့္ ဖိုင္ကုိအရင္ေဒါင္းလိုက္ပါ။ ျပီးရင္  dependencie လိုအပ္တာေတြကုိ ေ အာက္က  ကြန္မန္းနဲ့ ႏွစ္ခုသြင္းပါ။ sudo apt-get install g++ curl libssl-dev apache2-utils sudo apt-get install git-core ျပီးရင္ေတာ့ ေအာက္က ကြန္မန္းနဲ့တဆင့္ျခင္းသြင္းရင္ ဆင္ေျပပါျပီ။ cd node { download ဆြဲထားတဲ့ဖိုင္ကုိ ျဖည္ျပီးေတာ့ အဲဒီဖိုင္ထဲဝင္ } ./configure make sudo make install ရမရစမ္းဖုိ့အတြက္က ေအာက္က tut ေလးစမ္းျပီးသိႏုိင္ပါတယ္။ ေအာက္က ကုတ္ေတြကုိ test.js ဆိုျပီးတခုခုေပးပီး တေနရာရာသိမ္းလုိက္ပါ။ var http = require ( 'http' ); http . createServer ( function ( req , res ) {   res . writeHead ( 200 , { 'Content-Type' : 'text/plain' });   res . end ( 'Hello Node.js\n' ); }). listen ( 8124 , "127.0.0.1" ); console . log ( 'Server running at http://127.0.0.1:8124/' ); သိမ္းျပီးရင္ Terminal ထဲကေန node test.js ဆိုျပီးေခၚရင္   Server running at http://127.0.0.1:8124/ ဆိုျပီးေပၚေ