ã¯ããã¦ã® node.js
CentOSä¸ã§ node.js ã触ã£ãè¨é²ã§ãã
â node.js(以ä¸ãnode) ã¨ã¯
ãµã¼ããµã¤ãJavaScript
ãã³ããããã³ã°I/Oã¨ã¤ãã³ãã«ã¼ããç¹å¾´
â ç°å¢
CentOS 6.0 on VMWare
â node ã¤ã³ã¹ãã¼ã«
$ cd /usr/local/src $ wget http://nodejs.org/dist/v0.8.6/node-v0.8.6.tar.gz $ tar xvfz node-v0.8.6.tar.gz $ cd node-v0.8.6 $ ./configure $ make $ sudo make install $ make clean <|| éä¸ g++ ãå¿ è¦ã ã£ãã®ã§ã¤ã³ã¹ãã¼ã«ãã¦ãã >|| $ sudo yum install gcc-c++.i686
â ããã±ã¼ã¸ç®¡çãã¼ã« npm
node ãã¤ã³ã¹ãã¼ã«ããã¨ãä¸ç·ã«æ¨æºã§ã¤ã³ã¹ãã¼ã«ãããã
ã»ã¤ã³ã¹ãã¼ã«ï¼ ã°ãã¼ãã«
$ sudo npm install -g ããã±ã¼ã¸å
npm ã®ã¤ã³ã¹ãã¼ã«å ´æã«ããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã«ãã
ã¤ã³ã¹ãã¼ã«å
/usr/local/lib/node_modules/ããã±ã¼ã¸å
ã»ã¤ã³ã¹ãã¼ã«ï¼ ãã¼ã«ã«
$ sudo npm install ããã±ã¼ã¸å
ã«ã¬ã³ããã£ã¬ã¯ããªã«ããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã«ãã
ã»ã¤ã³ã¹ãã¼ã«æ¸ã¿ä¸è¦§ã®ç¢ºèª
$ npm list [-g]
ã»ããã±ã¼ã¸ã®ã¢ãããã¼ã
$ npm update [-g]
â Webã¢ããªã±ã¼ã·ã§ã³ãã¬ã¼ã ã¯ã¼ã¯(express)ã®ã¤ã³ã¹ãã¼ã«
$ sudo npm install -g express
â ã¢ããªã±ã¼ã·ã§ã³ä½æ
ã¢ããªã±ã¼ã·ã§ã³ä½æå
ã®ãã£ã¬ã¯ããªç¨æ
$ cd /usr/local/ $ sudo mkdir node-apps $ sudo chown ringio:ringio node-apps $ cd node-apps
ã¢ããªã±ã¼ã·ã§ã³ä½æ
$ express firstapp create : firstapp create : firstapp/package.json create : firstapp/app.js create : firstapp/public create : firstapp/public/javascripts create : firstapp/public/images create : firstapp/public/stylesheets create : firstapp/public/stylesheets/style.css create : firstapp/routes create : firstapp/routes/index.js create : firstapp/views create : firstapp/views/layout.jade create : firstapp/views/index.jade install dependencies: $ cd firstapp && npm install run the app: $ node app $ cd firstapp $ sudo npm link express jade
nodeèµ·å
$ node app
ãã©ã¦ã¶ããã¢ã¯ã»ã¹ç¢ºèª
http://localhost:3000/
nodeåæ¢
node app.js ã®ã³ã³ã½ã¼ã«ã Ctl + c
â åè
http://gihyo.jp/dev/serial/01/nodejs
http://d.hatena.ne.jp/ruedap/20110620/node_js_express_app_generate