Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?
https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager åºæ¬ã¯ããã®ubuntuã®ã¨ãã $ sudo apt-get install python-software-properties $ sudo add-apt-repository ppa:chris-lea/node.js $ sudo apt-get update $ sudo apt-get install nodejs ããã§ãnode.jsã¨npmã¤ã³ã¹ãã¼ã«å®äºã以ä¸ã®ã³ãã³ãã§ç¢ºèª $ node -v v0.10.1 $ npm -v 1.2.15 表示ã§ããããã¹ãéã£ã¦ã¾ãã 次ã«expressã¨coffee-scriptãnpmã§å°å ¥ $ sudo npm install -g express coffee-scrip
Express 4 ããªãªã¼ã¹ãããã®ã§ããã£ãã試ãã¦ã¿ã¾ããã ãªããã³ã¼ã㯠github ã«ä¸ãã¦ã¿ã¾ããã https://github.com/hoshi-takanori/express-sample ããã¸ã§ã¯ãä½æ Express 3.x ã§ã¯ããã¸ã§ã¯ãã®éå½¢ãä½æããããã® express ã³ãã³ããç¨æããã¦ãã¾ããããExpress 4 ã§ã¯å»æ¢ã¨ããããå¥ããã±ã¼ã¸ (express-generator) ã«åé¢ãããããã§ãã åºæ¬çã« app.js (㨠package.json) ãããã°ããã®ã§ãexpress ã³ãã³ãã¯ä½¿ããªãã¦ã大ä¸å¤«ã§ããã°ãã¼ãã«ã« express ããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã«ããå¿ è¦ãããã¾ããã é©å½ãªãã£ã¬ã¯ããªãä½ã£ã¦ app.js 㨠package.json ãä½ãã¾ãã
CSS㯠/css/* ã«ãJS㯠/js/* ã«ç½®ãã¦ããåæã§ã ãªã¯ã¨ã¹ãããã£ãã¨ãã«è©²å½ãããã¡ã¤ã«ãåå¨ãã¦ãã° fs.readFileã§ãã¡ã¤ã«ãè¿ãããã«ããã è¿ãã¨ãã¯res.writeHead(200, {'Content-Type': contentType});ã§Content-Typeãheadã«å«ãã¦è¿ãã var fs = require('fs') , path = require('path') , express = require('express') , app = express.createServer(); // staticãªCSS, JSãã¡ã¤ã« app.get(/^\/(?:css|js)\/.+/, function(req, res) { var contentType = undefined , filePath = __dirn
Nodeã§ãã¡ã¤ã«ãèªã¿è¾¼ã Node.jsã§ãã¡ã¤ã«ã®èªã¿æ¸ãããã¡ã¤ã«ã·ã¹ãã ã®æä½ãè¡ãã¨ãã¯ãfsã¢ã¸ã¥ã¼ã«ã使ç¨ããã ã¾ãã¯ãã¡ã¤ã«ã®èªã¿è¾¼ã¿ãããã£ã¦ã¿ãã 以ä¸ã®ãã¡ã¤ã«ãç¨æããã vi test.txt ------------ test hoge ------------ ã§ãä¸è¨ã®test.txtãã¡ã¤ã«ãèªã¿è¾¼ãNodeã®ãµã³ãã«ã¯ä»¥ä¸ã®éãã var fs = require('fs'); fs.readFile('./test.txt', 'utf8', function (err, text) { console.log('text file!'); console.log(text); console.log('error!?'); console.log(err); }); å®è¡ããã $ node readtest.js çµæã¯ä»¥ä¸ã®éãã [sysm
æè¿ãnode.jsã使ãå§ãã¾ãããã¡ãã£ã¨ããwebãµã¼ããç°¡åã«æ¸ãã¦ããã§ãããnode.jsã§MongoDBãæ±ãã«ã¯ mongoose ãã¤ããã¨ããã楽ã§ããããããmongooseã使ãéã«ã¯ã¹ãã¼ããå®ç¾©ããªããã°ããã¾ãããHTTP POSTã®body(JSONå½¢å¼)ã®ããã«ä½ãé£ãã§ãããåãããªãå ´åã«ãã¹ãã¼ãã¬ã¹ã«ã¨ããããçªã£è¾¼ãã§ããããã¨ããã¨ãã«ã¯ãSchema.Types.Mixed ã¨ããåãæå®ãã¦ã¹ãã¼ããä½æããã°ãä½ã§ãæ ¼ç´ã§ããJSONãã¼ã¿ããã®ã¾ã¾æ ¼ç´ã§ãã¾ãã ç°å¢ OS: OS X 10.9.4 node.js: v0.10.32 mongoose: v3.8.18 MongoDB: v2.6.4 ä¸æºåï¼mongooseããªããã°ãnpmã§ã¤ã³ã¹ãã¼ã«ã§ãã¾ãã $ npm install mongoose ã½ã¼ã¹ node.js
node.jsã§éçºãã¦ããã¨ããµã¼ãå´ã®ãããã°ã¯åç´ãªå ´åãconsole.logã使ã£ã¦å¤æ°ãªã©ãã³ã³ã½ã¼ã«ã«åºåããã¨æãã¾ãããã ãããã ã¨ãªãã¸ã§ã¯ããªã©ã®å¤æ°ãå±éããã¦è¡¨ç¤ºããããããå¤æ°ã®æ§é ãè¾¼ã¿å ¥ã£ããã®ã®å ´åãã¨ã¦ãæ¢ãã«ããäºãããã¾ãã PHPãªã©ã§ãã¯ã©ã¤ã¢ã³ããã©ã¦ã¶ã®ã³ã³ã½ã¼ã«ã«åºåãããã¼ã«ãªã©ã¯ããã¾ãããnode.jsã§ãåããããã¾ããããã¤ãé¸æè¢ãããã¾ããããã®ãã¡ã®ããã¤ããæãã¦ãããã¨æãã¾ãã Chrome Logger ã¾ãã¯Chromeã®Extensionããã¦ã³ãã¼ããã¾ããChrome ã¦ã§ãã¹ãã¢ã¯ãã¡ãã ãããnodeå´ã®ã¢ã¸ã¥ã¼ã«ããã®ãã¼ã¿ãåä¿¡ãã¦è¡¨ç¤ºãã¦ããã¾ãã express-chrome-logger ååã®éããExpress.jsã§ç°¡åã«ä½¿ãäºãæ³å®ããã¦ããããã§ãã ã§ã¯ããã£ããã¤ã³ã¹ãã¼ã«ãã¦ä½¿
ããã«ã¡ã¯ãã¨ã³ã¸ãã¢ãªã®ã«ãã³ã¯ãã§ããªãã®ã³ããã§ããä»æããè¨äºãæ¸ããã¦ããã ãã¾ãã ãã¦ã¿ãªãããNode.jsãã£ã¦ç¥ã£ã¦ãã¾ããï¼ åãæè¿Node.jsã®åå¼·ãå§ããã®ã§ãNode.jsã使ã£ããã¨ããªããã©ä½¿ã£ã¦ã¿ãããã¨æã£ã¦ãã人ã«åãã¦ãNode.jsã®å ¥éçãªå 容ãç´¹ä»ãããã¨æãã¾ãã â¼2020å¹´ææ°çã¯ãã¡ãï¼ Node.jsã¨ã¯ ä¸è¨ã§è¨ãã¨ã¢ããJavaScriptã§ãã é常ãJavaScriptã¯ã¦ã¼ã¶ã¼ã®ãã©ã¦ã¶ã§åä½ããããã°ã©ãã³ã°è¨èªã§ãããNode.jsã¯ãµã¼ãã¼å´ã§åä½ããJavaScriptã§ãããWebæ¥çã§ã¯ããªã注ç®ããã¦ãã¾ãã大éã®å¦çã«å¯¾å¿ããããã«ããã³ããããã³ã°I/Oã¨ããã¢ãã«ãæ¡ç¨ãã¦ãã¾ãã ä¾ãã°ããã¼ã¿ãã¼ã¹ãã大éã®æ å ±ãåå¾ãã¦Webãã¼ã¸ä¸ã«è¡¨ç¤ºãããå¦çããããªãå ´åãé常ã¯ãã¼ã¿ãã¼ã¹ã¸ã¢ã¯ã»ã¹ã
2011.6.14è¿½è¨ ãã¢ãµã¤ãã追å ãã¾ããã 2011.6.6è¿½è¨ node.jsã®ææ°çã§åä½ããããã¨ã³ããªãä¿®æ£ãã¾ããã 2011.5.25è¿½è¨ GitHubã«ã¢ãããã¾ããã詳ããã¯ä»¥ä¸ã®ã¨ã³ããªãã覧ãã ããã (ç¶)node.jsã¨CSSSlide.jsã§ã¹ã©ã¤ãå ±æãããµã³ãã«ããã°ã©ã ãä½ã£ããã - 大人ã«ãªã£ããèºå¼å¸ ã¯ããã« ãã®ã¨ã³ããªã§ã¯ãnode.js + WebSocket(socket.io) + CSSSlide.jsã使ã£ã¦ããªã¢ã«ã¿ã¤ã ã§ãã¬ã¼ã³ãã¼ã·ã§ã³ã®ã¹ã©ã¤ããå ±æãããµã³ãã«ããã°ã©ã ãä½ã£ã¦ã¿ã¾ããã WebSocketã¯Webä¸ã§ãµã¼ãã¨ã¯ã©ã¤ã¢ã³ãã¨ã®ç¸äºéä¿¡ãå¯è½ã«ããä»å¾æ³¨ç®ã®æè¡ã§ããWebSocketã§ããµã¼ãããã¯ã©ã¤ã¢ã³ãã«ãã¼ã¿ãPush(é ä¿¡)ã§ããããã«ãªãã¾ãã ãªã¢ã«ã¿ã¤ã ã®ã¹ã©ã¤ãå ±æ ãªã¢ã«ã¿ã¤ã ã§ãã¬
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}