Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?
2011å¹´10æ08æ¥ node.jsï¼åææ¥ç¶ãã¦ãã¯ã©ã¤ã¢ã³ããå¢ããç¶ãã¦ã¿ãã¨ãã®ã¡ã¢ node.jsã«æ¥ç¶ãã£ã±ãªããªã¯ã©ã¤ã¢ã³ããå¢ããã¨ã©ããªãããã¹ããã¦ã¿ãã ç¥ãããã£ãã®ã¯ã¡ã¢ãªãCPUã®ä½¿ç¨éãã©ããªãããæ¥ç¶ä»¶æ°ã¯ããã»ã©ã¾ã§okããã¨ãã£ããã¨ã æ¥ç¶æ°ãã©ãã£ã¦å¢ãããã«ã¤ãã¦ã¯ããæ¡ãæµ®ãã°ãªãã£ãã®ã§ããã¿ã³ãæ¼ãã¨çªãä½åãéããã©ã¯ã©ãç¨æããã çªãè¤æ°åãã£ãºãã«éããã¿ã³ã®ä»ã«ãæ¥ç¶ä»¶æ°ãåãåããããã¿ã³ãä»ãããã¨ã§æ¥ç¶æ°ãã¡ããã¡ãã確èªããªããçªãã°ãã°ãéãã¦ã¿ããã¨ã«ã node.jsã®åææ¥ç¶æ°ä¸éã¯ãã¡ã¤ã«ãã£ã¹ã¯ãªãã¿ã®ä¸éæ°ã«å·¦å³ããã ã¨ããã®ãç¥ãããã¨ã æ¥ããããªãããã¡ã¤ã«ãã£ã¹ã¯ãªãã¿ãªããã®ãç¥ããªãã£ãã®ã§ããããç¥ããã®ããã©ã¹ãã 以ä¸ããã¹ãã®æã®ãã¼ãæ¸ãã ãµã¼ãã¯ãããã®VPSã§ã512
expressã«ã¢ã¸ã¥ã¼ã«ãããã #!/usr/bin/env node var basicAuth = require('express').basicAuth; var app = require('express').createServer(); // å ¨ã¦ã®ã¢ã¯ã»ã¹ã«å¯¾ãã¦Basicèªè¨¼ãããã app.all('/', basicAuth(function(user, pass) { return 'admin' == user && 'express' == pass; })); app.all('/*', basicAuth(function(user, pass) { return 'admin' == user && 'express' == pass; })); app.get('/', function(req, res) { res.send('hello wo
app.use(express.basicAuth('username', 'password')); ããã㯠app.use(express.basicAuth(function(user, password) { return user === 'username' && password === 'password'; })); ããããªãä¸ã®ã»ããç°¡åã ãã©ä¸ã®æ¹ãæè»ã ãã¹ã§åããããªã app.all('/hoge/*', express.basicAuth(function(user, password) { return user === 'username' && password === 'password'; })); ã¨ãã è¨å®ã«basicèªè¨¼ãåå¨ãã¦ããã¨ãã ãbasicèªè¨¼ããã¦ãããã«è¤æ°ã¦ã¼ã¶ã¼è¨å®ã§ããããã«ããããã«ãããªæãã«ããã if (c
æ°è¦äºæ¥ã®ã·ã¹ãã ã§ãnode.jsã使ããã¨ã«ãªã£ãã®ã§ (ã¾ããæè¡å ¨è¬ã¯ã¾ãããã¦ãã®ã§ãåæã«node.js使ããããçãªã®ãã§ä½¿ã£ã¦ããã ãã©ã) node.js + express ã¨ãã§ããã£ã¦ãããã調æ»ãã¦ãµã¤ãä½ã£ã¦ã¿ã¦ããã node.jsã®FWã§ã¯expressãã¡ã¸ã£ã¼ãããªã®ã§ã¨ããããexpressã使ã£ã¦ã¿ãäºã«ã expressã§ã¯ãã³ãã¬ã¼ãã¨ã³ã¸ã³ããããã種é¡ãããããã®ã ãã© Jadeãããã©ã«ãã§ã¯(expressã³ãã³ãã§ä½ãæå®ããªãã¨Jadeã«ãªã)使ããã¦ãã¾ããããHTMLã®å½¢ã«è¿ãejsã使ã£ã¦ã¿ãäºã«ã ãã®éã«ãejsã®partialã使ãæ¹æ³ããã¾ãWEBã«æ å ±ãä¹ã£ã¦ããªãã£ãã®ã§ã¡ã¢ãã¦ããã æé ubuntu10.4ä¸ã§è©¦ããã node.js, express ã®ã¤ã³ã¹ã³ã¯ãã®ããããåèã«ããã $ mkdir sa
Express ãã¤ããã©ã¼ãã³ã¹ããã¤ã¯ã©ã¹ãªWebéçºãNode.jsã«ã var app = express.createServer(); app.get('/', function(req, res){ res.send('Hello World'); }); app.listen(3000); 主ãªç¹å¾´ å ç¢ãªã«ã¼ãã£ã³ã° ãªãã¤ã¬ã¯ãã»ãã«ãã¼ åçãªãã¥ã¼ãã«ãã¼ ã¢ããªã±ã¼ã·ã§ã³ã¬ãã«ã§è¨å®å¯è½ãªãã¥ã¼ã»ãªãã·ã§ã³ ã³ã³ãã³ããã´ã·ã¨ã¼ã·ã§ã³ ã¢ããªã±ã¼ã·ã§ã³ã®ãã¦ã³ã é«ãããã©ã¼ãã³ã¹ã¸ã®ãã©ã¼ã«ã¹ ãã¥ã¼ã®æç»ã¨ãã¼ã·ã£ã«ã®ãµãã¼ã ç°å¢ã«ãã¨ã¥ãæ§æ ã»ãã·ã§ã³ã«ãã¨ã¥ããã©ãã·ã¥éç¥ Connectä¸ã«æ§ç¯ Executableã«ããç´ æ©ãã¢ããªã±ã¼ã·ã§ã³çæ åºç¯ãªãã¹ãç¯å² ã³ã³ããªãã¥ã¼ã¿ã¼ 以ä¸ã¯Expressã®ä¸»ãªã³ã³ããªãã¥ã¼ã¿ã§ã(é ä¸å)ã TJ
express2.5ããexpressã³ãã³ãã§ããã¸ã§ã¯ãã¤ããã¨./routesã£ã¦ãã£ã¬ã¯ããªã«ã«ã¼ãã£ã³ã°ãæ¸ãããããã«ãªã£ã¦ããè¦æ¨¡ã大ãããªãã»ã©ç ©éã«ãªãã®ã§ãã«ã¼ãã£ã³ã°ã®ãã¡ã¤ã«ã¯åããã»ããããã¨æããã©ãããã§ãå人çã«ã¯ããå¾®å¦ã var express = require('express') , routes = require('./routes') ... app.get('/', routes.index); ãããªæãã«ãªã£ã¦ãããã ãã©ãããã ã¨ã«ã¼ãã£ã³ã°ãå¢ãã¦ã³ã³ããã¼ã©ã¼ã®ãã¡ã¤ã«ãããããã¨ãã«ãæ¯årequireãæ¸ããªãã¨ãããªããã¤ã¾ã var express = require('express') , routesIndex = require('./routes/index') , routesEntry = require('
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}